private void CreateBullet() { manager.findFacing(); dir = manager.facingdir; GameObject b = BulletPool.Instance.GetBullet(BulletPool.BulletTypes.FireBall); if (b != null) { //b.GetComponent<FireBall>().enemy = this.gameObject.transform; if (dir == SingleAttackManager.Direction.right) { b.transform.position = rtLoc.position; b.transform.rotation = rtLoc.rotation; } else if (dir == SingleAttackManager.Direction.left) { b.transform.position = ltLoc.position; b.transform.rotation = ltLoc.rotation; } else if (dir == SingleAttackManager.Direction.down) { b.transform.position = bmLoc.position; b.transform.rotation = bmLoc.rotation; b.GetComponent <SpriteRenderer>().sortingOrder = 0; } else if (dir == SingleAttackManager.Direction.up) { b.transform.position = tpLoc.position; b.transform.rotation = tpLoc.rotation; } allowAttack = true; } }
private void Awake() { allowAttack = true; manager = this.GetComponent <SingleAttackManager>(); manager.findFacing(); dir = manager.facingdir; }