public void Shoot(GameObject Owner) { if (cooldown <= 0) { cooldown = Cooldown; Shooting(Owner); GetComponent <AudioManager>()?.PlaySound(Sound.Activation.Shoot); if (HeatGain > 0) { SpaceShips ship = Owner.GetComponent <SpaceShips>(); if (ship != null) { ship.Heat += HeatGain; } } } if (ExtraCannons.Length > 0) { foreach (Weapon c in ExtraCannons) { c.Shoot(Owner); } } }
private void onWhenSpacehipDie(TextAsSprite i_ScoreAsText) { SettingsManager.AddPlayerScore(i_ScoreAsText); if (SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count() == 0) { if (NotifiyGameOver != null) { NotifiyGameOver(); } } }
static void Main() { Dialogue dialogue = new Dialogue(); SpaceShips firstShip = new SpaceShips(); string name, shipName; Console.WriteLine(dialogue.intro()); name = dialogue.characterName(); shipName = dialogue.shipName(); Console.Clear(); dialogue.beginnerShip(); Console.Write("Please enter the number of the ship that you want: "); firstShip.chooseFirstShip(); }
private void setNumberOfPlayers() { int i = SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count(); if (PlayersCount > SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count()) { SpaceShips["SpaceShip2"].Enabled = SpaceShips["SpaceShip2"].Visible = true; SpaceShips["SpaceShip2"].WhenIDie += onWhenSpacehipDie; SpaceShips["SpaceShip2"].Add(); } else { SpaceShips["SpaceShip2"].Enabled = SpaceShips["SpaceShip2"].Visible = false; SpaceShips["SpaceShip2"].WhenIDie -= onWhenSpacehipDie; SpaceShips["SpaceShip2"].Remove(); } }
public List <SpaceShip> GetSpaceShips() { SpaceShips spaceShips = new SpaceShips(); using (var client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync(string.Concat(this.UrlApi + "starships")).Result; if (response.StatusCode == System.Net.HttpStatusCode.OK) { string responseBody = response.Content.ReadAsStringAsync().Result; spaceShips = JsonConvert.DeserializeObject <SpaceShips>(responseBody); } } return(spaceShips.results); }
static void Main() { Dialogue dialogue = new Dialogue(); SpaceShips firstShip = new SpaceShips(); string name, shipName; Console.WriteLine(dialogue.intro()); name = dialogue.characterName(); shipName = dialogue.shipName(); Console.Clear(); dialogue.beginnerShip(); Console.Write("Please enter the number of the ship that you want: "); firstShip.chooseFirstShip(); //these variables are utilized to carry over values between Planets int fuel = firstShip.fuel; int maxFuel = firstShip.fuel; int storage = firstShip.storage; int maxStorage = firstShip.storage; double money = 15000; int gameMaster = 0; int nextLocation; int[] inventory = { 0, 0, 0, 0, 0 }; //This is how the invetory works: index 0 = wheat, 1=space beans, 2 = space goo, 3=alien chicken,4=space rocks Console.Clear(); while (gameMaster != 1) //gameMaster++ will end the game { //first 2 objects iterate through their menu outside of the whle-switch Garthar garthar = new Garthar(money, storage, fuel, maxStorage, maxFuel, inventory); garthar.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = garthar; Eduthear eduthear = new Eduthear(money, storage, fuel, maxStorage, maxFuel, inventory); eduthear.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = eduthear; Solanium solanium = new Solanium(money, storage, fuel, maxStorage, maxFuel, inventory); Hochienus hochienus = new Hochienus(money, storage, fuel, maxStorage, maxFuel, inventory); Nauter nauter = new Nauter(money, storage, fuel, maxStorage, maxFuel, inventory); Apocolypsis apocolypsis = new Apocolypsis(money, storage, fuel, maxStorage, maxFuel, inventory); while (nextLocation >= 0 && nextLocation <= 5) { if (maxFuel == 78111101) //Noe in computer alphabet { gameMaster++; //ends game nextLocation = 6; //exists the while loop } else { switch (nextLocation) //nextLocation determinded by case 3 in every planets menu { case 0: garthar.money = money; garthar.storage = storage; garthar.fuel = fuel; garthar.maxStorage = maxStorage; garthar.maxFuel = maxFuel; garthar.inventory = inventory; garthar.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = garthar; break; case 1: eduthear.money = money; eduthear.storage = storage; eduthear.fuel = fuel; eduthear.maxStorage = maxStorage; eduthear.maxFuel = maxFuel; eduthear.inventory = inventory; eduthear.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = eduthear; break; case 2: solanium.money = money; solanium.storage = storage; solanium.fuel = fuel; solanium.maxStorage = maxStorage; solanium.maxFuel = maxFuel; solanium.inventory = inventory; solanium.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = solanium; break; case 3: hochienus.money = money; hochienus.storage = storage; hochienus.fuel = fuel; hochienus.maxStorage = maxStorage; hochienus.maxFuel = maxFuel; hochienus.inventory = inventory; hochienus.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = hochienus; break; case 4: nauter.money = money; nauter.storage = storage; nauter.fuel = fuel; nauter.maxStorage = maxStorage; nauter.maxFuel = maxFuel; nauter.inventory = inventory; nauter.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = nauter; break; case 5: apocolypsis.money = money; apocolypsis.storage = storage; apocolypsis.fuel = fuel; apocolypsis.maxStorage = maxStorage; apocolypsis.maxFuel = maxFuel; apocolypsis.inventory = inventory; apocolypsis.planetMenu(); (money, storage, fuel, maxStorage, maxFuel, inventory, nextLocation) = apocolypsis; break; } } } } Console.WriteLine("After returning to Garthar with the final ship, you have boarded your entire species and have merely escaped the damnation of your planet!\n +" + "You will forever be remebered as a hero by the Gartharians!"); }