public bool CollideCosmonaut(Rocket rocket, Cosmonaut cosmonaut) { rocketSize = new Point(rocket._tex.Width, rocket._tex.Height); cosmonautSize = new Point(cosmonaut._tex.Width, cosmonaut._tex.Height); Rectangle rocketRect = new Rectangle((int)rocket._position.X, (int)rocket._position.Y, rocketSize.X, rocketSize.Y); Rectangle cosmonautRect = new Rectangle((int)cosmonaut._position.X, (int)cosmonaut._position.Y, cosmonautSize.X, cosmonautSize.Y); return(rocketRect.Intersects(cosmonautRect)); }
// Initialization void Start() { // Set the turnLenght turnLenght = 18; // Set the first turn to true firstTurn = true; // Populate the game objects for cosmonauts and maraptors Cosmonauts.AddRange(GameObject.FindGameObjectsWithTag("Cosmonaut")); Maraptors.AddRange(GameObject.FindGameObjectsWithTag("Maraptor")); // Populate the State Machines for cosmonauts and maraptors, editing their names and startup properites foreach (GameObject Cosmonaut in Cosmonauts) { cosmonautP = Cosmonaut.GetComponent <cosmonautBase> (); cosmonautP.name = Cosmonaut.transform.gameObject.name; cosmonautP.baseHP = 100; cosmonautP.currentHP = 100; cosmonautP.baseShield = 50; CosmonautStateMachines.Add(Cosmonaut.GetComponent <cosmonautStateMachine> ()); } foreach (GameObject Maraptor in Maraptors) { maraptorP = Maraptor.GetComponent <maraptorBase> (); maraptorP.name = Maraptor.transform.gameObject.name; maraptorP.baseHP = 100; maraptorP.currentHP = 100; maraptorP.baseShield = 50; MaraptorStateMachines.Add(Maraptor.GetComponent <maraptorStateMachine> ()); } // Get the numberOfCosmonauts and numberOfMaraptors numberOfCosmonauts = Cosmonauts.Count; numberOfMaraptors = Maraptors.Count; // Set the number of player characters and the number of played on characters numberOfPlayerCharacters = numberOfCosmonauts + numberOfMaraptors; numberOfPlayedOnCharacters = 0; // Get the MainCameraPlayer MainCameraPlayer = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <cameraFollowPlayer> ();; // Get the Action Menu AM = GameObject.Find("ActionMenu").GetComponent <actionMenuScript>(); // Start Game GameState = GameStateEnum.INTRO; turnTimer = 0; StartCoroutine("TurnTimerIncrementor"); }