//Main Methods // Start is called before the first frame update void Start() { canInteract = true; clickController = gameObject.GetComponent <ClickController>(); abilityButtons = FindObjectOfType <UIController>().GetButtons(); player = FindObjectOfType <MotherShipController>(); // TODO: Set variables up in GameTags to change these numbers to easily resettable variables abilityValues = new List <int> { GameTags.checkShipSendValue, 2, 3, 4, 5 }; shipScale = 0.5f; }
//Finds the mothership that is associated with this commander's color private void FindMothership() { //Finds all motherships List <MotherShipController> motherships = new List <MotherShipController>(FindObjectsOfType <MotherShipController>()); foreach (MotherShipController mothership in motherships) { //chooses the one with it's color if (mothership.GetAllegianceTag() == commanderTag) { commanderMothership = mothership; } } }
IEnumerator SpawnMotherShip() { if (motherShip != null) { Destroy(motherShip.gameObject); } yield return(new WaitForSeconds(Random.Range(5f, 30f))); motherShip = Instantiate(motherShipPrefab).GetComponent <MotherShipController>(); int screenSide = Random.Range(0, 2) * 2 - 1; Vector3 motherPosition = new Vector3((Camera.main.orthographicSize + motherShip.GetComponent <SpriteRenderer>().bounds.max.x *motherShip.transform.localScale.x) * screenSide, initialPosition.y, 0); motherShip.transform.position = motherPosition; motherShip.SetMotion(-screenSide); }