public IEnumerable <GameObject> GetTargetsForShooting() { if (PlayerTank.Instance != null) { // Vector3 pos = PlayerTank.Instance.transform.position; // yield return new Vector2(pos.x, pos.z); yield return(PlayerTank.Instance.gameObject); } if (Flag.Instance != null) { yield return(Flag.Instance.gameObject); // objects around flag Vector2 flagPos = Flag.Instance.Position; foreach (Vector2 posOffset in s_positionsAroundFlag) { Vector2 pos = flagPos + posOffset; if (MapManager.IsInsideMap(pos)) { var mapObj = MapManager.GetMapObjectAt(pos); if (mapObj != null) { yield return(mapObj.gameObject); } } } } // player tank's bullets // foreach (Bullet bullet in Bullet.AllBullets.Where(b => b.TankShooter != null && b.TankShooter == PlayerTank.Instance)) // { // yield return bullet.gameObject; // } }
public bool CanWalkToBlock(Vector2 blockPos) { if (!MapManager.IsInsideMap(blockPos)) { return(false); } var mapObj = MapManager.GetMapObjectAt(blockPos); if (mapObj != null && !mapObj.IsPassable) { return(false); } return(!IsAnyTankAtBlock(blockPos, this)); //return true; }