private void OnDisable() { if (spawner == null) { spawner = GameObject.FindObjectOfType <CannonSpawner>(); } spawner.CannonLost(); }
void Awake() { singleton = this; }
protected void Initialize() { if (Collection) { //Create teh collection Particle Effect Collection = Instantiate(Collection) as ParticleSystem; Collection.transform.position = transform.position; Collection.transform.parent = transform; } if (PreparingEffect) { //Create the effect PreparingEffect = Instantiate(PreparingEffect) as ParticleSystem; PreparingEffect.transform.parent = transform; PreparingEffect.transform.localPosition = Vector3.zero; } //Get the connect Controller. connectorcontroller = GetComponentInChildren <CannonConnector>(); if (connectorcontroller == null) { Debug.LogError("can't find cannon connector!!!!!!"); } connectorcontroller.SetHost(gameObject); //All bad guys have hot cannons so nobody else picks up their cannons after they drop it. connectorcontroller.SetHotCannon(ForbiddenWeapons); //Get the smart beam Eyes = GameObjectTracker.GetGOT().World._objectView; Hands = GetComponent <BlackHole>(); if (!Hands) { Debug.Log("No Black Hole created for enemy!"); } //Set the ID timestamp = (int)Time.time; if (!Eyes) { Debug.LogError("No Smartbeam found on enemy! Please make sure to attach Smart Beam!"); } CannonSpawner c = gameObject.GetComponentInChildren <CannonSpawner>(); //Lets look for a spawner. if (c) { mySpawner = c; } myTransform = transform; }