DealyBoom
yield return new WaitForSeconds(time)
Destroy(gameObject);
Instantiate()
Quaternion.identity
GameObject
Vector2
StartCoroutine("DealyBomm",dealyTime);
GetComponent<Bomb>().Init(2,1)
DealyBoom
yield return new WaitForSeconds(time)
Destroy(gameObject);
Instantiate()
Quaternion.identity
GameObject
Vector2
StartCoroutine("DealyBomm",dealyTime);
GetComponent<Bomb>().Init(2,1)
炸弹爆炸完之后用了一个委托
superWallPointList
IsSuperWall
Contains
Instance
Destroy(gameOject);
(collision.CompareTag("BombEffect"))
Destroy(gameObject)
idInjurd
SuperWall = "SuperWall";
BombEffect
player.GetComponent<playerCtrl>().Init(1, 3, 2);
Sprite
doorSprite
private SpriteRenderer spriteRenderer;
GetComponent<SpriteRenderer>();
.sprite
if (collision.CompareTag(Tags.BombEffect))
isTrigger
Transform
Destroy(item.gameObject)
Update
Input.GetKeyDown(KeyCode.N))
1.将墙搞成预制体(缩放改成3.15, 不要有空隙)
2.地图生成
挂脚本
instantiate实例化 相当于克隆
3. Awake和 start 是unity中的生命周期函数,自动调用
1.为了生成另一边墙,直接更改 参数 -X,-Y
2.发现生成的目标偏移,可以改变主相机的位置,更为-1,-1,随意更改即可
3.for循环是一种允许所编写特定次数的循环的重复结构
创建一个空物体作为游戏生成体运用Instantiate生成预设体的方法
寻找地图上空的格子生成可以被炸掉的墙壁,运用for循环的嵌套遍历每个点,如果遍历到了地图上空格子的坐标,就放在一个集合里。
使用for循环遍历存放空格子的集合,用Random.Range取一个随机的坐标,然后生成一个可以被炸掉的
找到可以被炸掉的砖,在它后面生成一个传送门
ObjectPool
Dictionary
GameObject
Instantiate
transform
GameObject
rotation=Quaternion.identity
生成道具和传送门也是使用instantiate和随机数Random.Range()
图纸切分,将图纸的Sprite Mode改为Multiple之后点击Sprite Editor,再点击slice就可以对图纸进行切割,这样人物
ObjectPool
SetActive