public TypeShot TakeABlow(int TestX, int TestY) { TypeShot type = TypeShot.MISS; foreach (Ship ship in ships) { type = ship.TakeAHit(TestX, TestY); Field.PushShip(ship); if (type == TypeShot.KILL) { Field.FillAround(ship); ships.Remove(ship); break; } else if (type == TypeShot.WOUND) { break; } } if (type == TypeShot.MISS) { Field.Hit(TestX, TestY, TypeSurface.HIT); } return(type); }
public bool DispatchShots(int TestX, int TestY) { bool result = false; TypeShot th = Bot.TakeABlow(TestX, TestY); if (th == TypeShot.MISS) { int rx; int ry; do { rx = r.Next(10); ry = r.Next(10); th = Player.TakeABlow(rx, ry); if (th == TypeShot.KILL) { ++Bot.InfoPlayer.Score; } } while (th != TypeShot.MISS); } else if (th == TypeShot.KILL) { ++Player.InfoPlayer.Score; } if (Player.InfoPlayer.Score == 10 || Bot.InfoPlayer.Score == 10) { result = true; } return(result); }
ShopItem GetInitialDataGivenType(TypeShot type) { ShopItem si = null; switch (type) { case TypeShot.SINGLE: si = new ShopItem(type, 1, 10, 20); break; case TypeShot.DOUBLE: si = new ShopItem(type, 0, 500, 20); break; case TypeShot.TRIPLE: si = new ShopItem(type, 0, 100000, 20); break; case TypeShot.FREEZER: si = new ShopItem(type, 0, 5000, 20); break; case TypeShot.EXPLODING: si = new ShopItem(type, 0, 20000, 10); break; case TypeShot.LASER: si = new ShopItem(type, 0, 1000000, 20); break; } return(si); }
public void Equip(TypeShot type, float aspeedShot) { shotType = type; speedShot = aspeedShot; PlayerPrefs.SetInt(typeShotKey, (int)shotType); PlayerPrefs.SetFloat(recoilTimeKey, speedShot); }
public ShopItem(TypeShot type, int level, int price, float speedShot) { _type = type; _level = level; _basePrice = price; _speedShot = speedShot; }
public void BuyItem(TypeShot type) { if (shopDic[type].CanBuyItem()) { shopDic[type].Buy(); } }
public void InitDeffense() { if (PlayerPrefs.HasKey(typeShotKey)) { shotType = (TypeShot)PlayerPrefs.GetInt(typeShotKey); } if (PlayerPrefs.HasKey(recoilTimeKey)) { timeBetweenShots = PlayerPrefs.GetFloat(recoilTimeKey); } }
public ShopData() { for (int i = 0; i < (int)TypeShot.COUNT; i++) { TypeShot type = (TypeShot)i; if (PlayerPrefs.HasKey(type.ToString())) { ShopItem item = GetInitialDataGivenType(type); item.SetUserValues(PlayerPrefs.GetInt(type.ToString())); shopDic.Add(type, item); } else { shopDic.Add(type, GetInitialDataGivenType(type)); } } }
public TypeShot TakeAHit(int TestX, int TestY) { TypeShot typeShot = TypeShot.MISS; foreach (Cell cell in Cells) { if (cell.X == TestX && cell.Y == TestY && !cell.Visit) { cell.Type = TypeSurface.WOUNDSHIP; cell.Visit = true; typeShot = TypeShot.WOUND; } } if (!this.Alive && typeShot == TypeShot.WOUND) { typeShot = TypeShot.KILL; } return(typeShot); }
public bool IsEquiped(TypeShot type) { return(shotType == type); }
public void SetItem(TypeShot aType) { }