Ejemplo n.º 1
0
    public void sendThemBack()
    {
        var CircleCenter = GetComponent <Transform>().transform.position;

        Affectables = Physics2D.OverlapCircleAll(new Vector2(CircleCenter.x, CircleCenter.y), CastRadius);
        Debug.Log("We called sendThemBack() at " + Time.unscaledTime + "\r\nNumber of objects within clock rock radius is " + Affectables.Length);
        GameObject cam = GameObject.Find("Main Camera");

        cam.GetComponent <ClockRockAudio>().ClockRockChange();
        foreach (Collider2D changing in Affectables)
        {
            Debug.Log("Object within radius of Clock Rock: " + changing.gameObject);
        }

        int objects_affected = 0;

        //Get the time state we want to change the radius to
        Timeable.timeState toChange = newTime();

        //Change the time state of all of the (affectable) objects in the radius
        foreach (Collider2D collider in Affectables)
        {
            Timeable iter = collider.gameObject.GetComponent <Timeable>();
            if (iter == null || iter.enabled == false)
            {
                continue;
            }
            else
            {
                objects_affected += 1;
                iter.changeTime(toChange);
            }
        }
        LocalTimeState = toChange;
        Debug.Log("Finished sendThemBack. Total number of objects changed: " + objects_affected);
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     l         = gameObject.GetComponent <LineRenderer>();
     gun       = transform.position;
     _timeable = gameObject.GetComponent <Timeable>();
 }