private GameObject prefabObject; // The actual location of the prefab that is moving // MONO FUNCTIONS ----------------------------------------------------------------------------- | /* * This function is called when the game is booted and is used for initializations. * */ void Start() { enter = transform.GetComponentInChildren <TriggerEnter>(); // Event listeners IDied.AddListener(nullPing); IGotHit.AddListener(nullPing2); IShot.AddListener(nullPing2); IPerformed.AddListener(nullPing3); enter.addItemListener(triggered); speedDisplay = prefabObject.transform.Find("SpeedUp").gameObject; powerDisplay = prefabObject.transform.Find("Power").gameObject; speedDisplay.SetActive(false); powerDisplay.SetActive(false); gm = GameObject.Find("Main Camera").GetComponent <GameManager>(); gm.addDamageListener(MyTeam, playerNumber, RecordHit); anim = prefabObject.transform.Find("Space_Soldier_A_LOD1").GetComponent <Animator>(); part = prefabObject.GetComponent <ParticleSystem>(); visible = new List <GameObject>(); visibleEnemyLocations = new List <Vector3>(); attackedFromLocations = new List <Vector3>(); moveDestination = prefabObject.transform.position; // These functions are called every second. useful for timers and other time based events InvokeRepeating("reloadTimerCountdown", 0.0f, 1.0f); InvokeRepeating("respawnTimerCountdown", 0.0f, 1.0f); InvokeRepeating("enemyLocationTimerCountdown", 0.0f, 1.0f); }
// Use this for initialization void Start() { InvokeRepeating("myFun", 0.0f, 3.0f); number = GetComponent <GameManager>().getNum(); Random.InitState(number); SpawnedItems = new List <GameObject>(); charb1.addItemListener(itemPickedUp); charb2.addItemListener(itemPickedUp); charb3.addItemListener(itemPickedUp); charr1.addItemListener(itemPickedUp); charr2.addItemListener(itemPickedUp); charr3.addItemListener(itemPickedUp); }