Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        Slowable otherSlowable = other.GetComponent <Slowable>();

        if (otherSlowable != null)
        {
            if (!affectedObjects.Contains(otherSlowable))
            {
                otherSlowable.SlowDown(slowFactor, this);
                affectedObjects.Add(otherSlowable);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnTriggerExit(Collider other)
    {
        Slowable otherSlowable = other.GetComponent <Slowable>();

        if (otherSlowable != null)
        {
            if (affectedObjects.Contains(otherSlowable))
            {
                otherSlowable.SlowDown(slowFactor, this);
                otherSlowable.EndSlowDown(this);
                affectedObjects.Remove(otherSlowable);
            }
        }
    }
Ejemplo n.º 3
0
 public void InitializeBubble(GameObject origin)
 {
     originObject    = origin;
     affectedObjects = new List <Slowable>();
     Collider[] colliders = Physics.OverlapSphere(transform.position, bubbleRadius);
     foreach (Collider other in colliders)
     {
         Debug.Log(other.gameObject.name);
         Slowable otherSlowable = other.GetComponent <Slowable>();
         if (otherSlowable != null)
         {
             Debug.Log("found");
             if (!affectedObjects.Contains(otherSlowable))
             {
                 Debug.Log("not contained");
                 otherSlowable.SlowDown(slowFactor, this);
                 affectedObjects.Add(otherSlowable);
             }
         }
     }
     myCollider.radius = bubbleRadius;
     Debug.Log("bam");
 }