private void OnEnable() { if (GameManager.chosen_ship == 2 && ship3_obj == null) { ship3_obj = FindObjectOfType <Ship3>(); } SkillUsable = true; player = shsp.Player; bars.rest_time = cds[GameManager.chosen_ship]; }
/// <summary> /// Initializes a new instance of the <see cref="LevelOne" /> class. /// </summary> public LevelOne() { // Backgrounds FileName = @"Assets\LevelOne.png"; // Enemies for (int i = 0; i < 7; i++) { var ship = new Ship(this); int positionY = ship.Height + 10; int positionX = 150 + i * (ship.Width + 50); ship.Position = new Point(positionX, positionY); Actors.Add(ship); } // Enemies2 for (int i = 0; i < 5; i++) { var ship2 = new Ship2(this); int positionY1 = ship2.Height + 30; int positionX1 = 180 + i * (ship2.Width + 50); ship2.Position = new Point(positionX1, positionY1); Actors.Add(ship2); } for (int i = 0; i < 4; i++) { var ship3 = new Ship3(this); int positionY = ship3.Height + 70; int positionX = 180 + i * (ship3.Width + 50); ship3.Position = new Point(positionX, positionY); //присваиваем значение Ship куда он должен лететь true false ship3.Movement = i < 2; Actors.Add(ship3); } // Player Player = new PlayerShip(this); int playerPositionX = Size.Width / 2 - Player.Width / 2; int playerPositionY = Size.Height - Player.Height - 50; Player.Position = new Point(playerPositionX, playerPositionY); Actors.Add(Player); var superm = new Superman(this); int positionYS = superm.Height + 10; int positionXS = superm.Width + 10; superm.Position = new Point(positionXS, positionYS); Actors.Add(superm); }
private void StartGameButtonHandler(object sender, EventArgs e) //кнопка для начала игры { //скрытие всех начальных элементов формы StartGameButton.Hide(); Ship1.Hide(); Ship2.Hide(); Ship3.Hide(); Ship4.Hide(); Ship5.Hide(); Ship6.Hide(); MartianBattleLabel.Hide(); //определение управляющего объекта m_controlGame = new Controller(this, NumbersOfLives, Platform, new TextBox[] { Ship1, Ship2, Ship3, Ship4, Ship5, Ship6 }); m_controlGame.StartGame(); //запуск игры }
private void Update() { if (player == null) { player = shsp.Player; } if (player.activeSelf) { foreach (GameObject obj in objects) { obj.transform.position = player.transform.position; } if (GameManager.chosen_ship == 2 && ship3_obj == null) { ship3_obj = FindObjectOfType <Ship3>(); } if (GameManager.skills[2].state - 1 > active_Fire_drones) { Fire_Drones[active_Fire_drones].SetActive(true); Fire_Drones[active_Fire_drones].transform.position = player.transform.position; active_Fire_drones++; PlayerPrefs.SetInt("Ship3_prog", PlayerPrefs.GetInt("Ship3_prog") + 1); } if (GameManager.skills[4].state - 1 > active_Shield_drones) { Shield_Drones[active_Shield_drones].SetActive(true); Shield_Drones[active_Shield_drones].transform.position = player.transform.position; active_Shield_drones++; PlayerPrefs.SetInt("Ship3_prog", PlayerPrefs.GetInt("Ship3_prog") + 1); } if (GameManager.skills[3].state - 1 > active_Rocket_drones) { Rocket_Drones[active_Rocket_drones].SetActive(true); Rocket_Drones[active_Rocket_drones].transform.position = player.transform.position; active_Rocket_drones++; PlayerPrefs.SetInt("Ship3_prog", PlayerPrefs.GetInt("Ship3_prog") + 1); } } else { Clear(); } }
public void runForOneShip(int ship_id, int run_times) { int morale = getMorale(this.portData, ship_id); Console.WriteLine("KANMUSU'S ID: " + ship_id); Console.WriteLine("INITIAL MORALE: " + morale); if (morale >= 81) { Console.WriteLine("Morale is " + morale + ". Skipping..."); return; } int run_count = 0; while (run_times != run_count) { if (morale >= 81) { Console.WriteLine("Morale is " + morale + ". Skipping the rest of iterations..."); break; } this.kcp.proxy(MapInfo.MAPINFO); Console.WriteLine("MapInfo done."); this.kcp.proxy(MapCell.MAPCELL, MapCell.Get(1, 1)); Console.WriteLine("MapCell done."); this.kcp.proxy(Map.START, Map.Start(1, this.fleet_id, 1, 1)); Console.WriteLine("STARTED."); Thread.Sleep(ONE_SECOND); this.kcp.proxy(Sortie.BATTLE, Sortie.Battle(1, 0)); Console.WriteLine("First battle done."); Thread.Sleep(TEN_SECONDS); this.kcp.proxy(Sortie.BATTLERESULT); Console.WriteLine("First battle results get."); Thread.Sleep(FIVE_SECONDS); this.kcp.proxy(Ship3.SHIP2, Ship3.Ship2()); Console.WriteLine("Ship2 get."); this.kcp.proxy(Map.NEXT, Map.Next()); Console.WriteLine("NEXT."); Thread.Sleep(ONE_SECOND); this.kcp.proxy(Sortie.BATTLE, Sortie.Battle(1, 0)); Console.WriteLine("Second battle done."); Thread.Sleep(TEN_SECONDS); this.kcp.proxy(Sortie.BATTLERESULT); Console.WriteLine("Second battle results get."); Thread.Sleep(FIVE_SECONDS); string port_data = this.kcp.proxy(ApiPort.PORT, ApiPort.port(this.member_id)); this.portData = JsonConvert.DeserializeObject <KanColleAPI <Port> >(port_data).GetData(); Console.WriteLine("Returned to port."); this.kcp.proxy(Hokyu.CHARGE, Hokyu.Charge(this.ship_list_string, ChargeKind.BOTH)); Console.WriteLine("Refueled."); Thread.Sleep(ONE_SECOND); Console.WriteLine("ROUND {0} COMPLETE.", ++run_count); morale = getMorale(this.portData, ship_id); Console.WriteLine("CURRENT MORALE: " + morale + "\n"); } }
void Awake() { Index = PlayerPrefs.GetInt("ShipSelection"); Ship0 = GameObject.Find("Ship0"); Ship1 = GameObject.Find("Ship1"); Ship2 = GameObject.Find("Ship2"); Ship3 = GameObject.Find("Ship3"); Ship4 = GameObject.Find("Ship4"); Ship5 = GameObject.Find("Ship5"); if (Index == 0) { Ship0.SetActive(true); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship0"); } if (Index == 1) { Ship0.SetActive(false); Ship1.SetActive(true); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship1"); } if (Index == 2) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(true); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship2"); } if (Index == 3) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(true); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship3"); } if (Index == 4) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(true); Ship5.SetActive(false); Player = GameObject.Find("Ship4"); } if (Index == 5) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(true); Player = GameObject.Find("Ship5"); } }