public static BombFlame Create(IntVector2 position, float lifetime) { prefab = Resources.Load("Prefabs/SingleBombFlame"); GameObject newObject = Instantiate(prefab) as GameObject; BombFlame bombFlame = newObject.GetComponent <BombFlame>(); bombFlame.position = position; bombFlame.transform.position = position.ToVector2(); bombFlame.lifetime = lifetime; return(bombFlame); }
public void Explode() { BombFlame.Create(position, 0.5f); foreach (Direction direction in Enum.GetValues(typeof(Direction))) { for (int l = 1; l < bombLength + 1; l++) { IntVector2 positionToFlame = position + direction.GetIntVector2() * l; SuckerbanObject obj = level.GetObjectInPosition(positionToFlame); if (obj is SteelWall) { break; } if (obj is BrickWall) { ((BrickWall)obj).Destroy(); break; } BombFlame.Create(positionToFlame, 0.5f); } } Destroy(transform.gameObject); }