public override void Fight() { //Debug.Log(string.Format("{0}:currentTeam-->{1}",tank.name,tank.team)); if (tank.direction != Vector2.zero) { BulletNormal.GetABullet(transform.position, tank.direction.normalized * speed, tank.team, damage); } }
public static BulletNormal GetABullet(Vector2 position, Vector2 velocity, int team, float damage) { foreach (BulletNormal blt in BulletPool) { if (!blt.actived) { blt.Active(); blt.transform.position = position; blt.velocity = velocity; blt.team = team; return(blt); } } BulletNormal nb = Instantiate(Battlemanager.ins.bulletSmall).GetComponent <BulletNormal>(); BulletPool.Add(nb); nb.transform.position = position; nb.velocity = velocity; return(nb); }