Esempio n. 1
0
 // Start is called before the first frame update
 void Awake()
 {
     rb                 = GetComponent <Rigidbody>();
     mover              = GetComponent <MoveTowardsPoint>();
     dyingBehaviour     = GetComponent <OrderAgentDying>();
     returningBehaviour = GetComponent <OrderAgentReturning>();
     scaler             = GetComponent <AgentScaler>();
     audioSource        = GetComponent <AudioSource>();
 }
Esempio n. 2
0
        private IEnumerator ShrinkRoutine()
        {
            AgentScaler scaler = GetComponent <AgentScaler>();

            scaler.SetScale(Vector3.zero, shrinkTime);

            yield return(new WaitForSeconds(audioSource.clip.length));

            // Reset to default size
            spawningBehaviour.enabled = true;
            scaler.ResetScale();
            if (OnDeath != null)
            {
                OnDeath(gameObject);
            }
            else
            {
                Debug.LogWarning("No delegate for order agent death");
            }
            ObjectPool.Instance.PoolObject(gameObject);
            this.enabled = false;
        }