void Start() { //add reference of this script to PoolManager's Properties dictionary, //this gets accessed by Projectile.cs on hit so we don't need a GetComponent call every time PoolManager.Props.Add(gameObject.name, this); //get movement reference myMove = gameObject.GetComponent <TweenMove>(); //get animation component anim = gameObject.GetComponentInChildren <Animation>(); //initialize our maxSpeed value once, at game start. //we don't need and want to set that on every spawn ( OnSpawn() ) //because the last enemy could have altered it at runtime (via slow) myMove.maxSpeed = myMove.speed; //also get this gameobject ID once, at runtime it stays the same myMove.pMapProperties.myID = gameObject.GetInstanceID(); //get healthbar/shield slider transform for rotating it later if (healthbar) { barParentTrans = healthbar.transform.parent.GetComponent <RectTransform>(); } else if (shield.bar) { barParentTrans = shield.bar.transform.parent.GetComponent <RectTransform>(); } //apply passive powerups to this enemy PowerUpManager.ApplyToSingleEnemy(this, myMove); }