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
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        if (boosted)
        {
            speed = boostSpeed;
        }
        else
        {
            speed = baseSpeed;
        }

        timer = lifeTime;

        Slowable = new Slowable();
    }
Ejemplo n.º 4
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");
 }
Ejemplo n.º 5
0
 public void RemoveSlowable(Slowable slowable)
 {
     slowableObjects.Remove(slowable);
 }
Ejemplo n.º 6
0
 public void RegisterSlowable(Slowable slowable)
 {
     slowableObjects.Add(slowable);
 }
Ejemplo n.º 7
0
 public Movable(){
     Slowable = new Slowable();
 }