Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (GetComponent <Rigidbody>().velocity.sqrMagnitude > 0.01)
        {
            TimeLeft = Mathf.Max(TimeLeft, 1);
        }

        TimeLeft -= Time.deltaTime;
        if (TimeLeft <= Mathf.Epsilon)
        {
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
        }

        if (!_ready)
        {
            CustomEventManager.Instance().SubscribeMove(HandleMovement);
        }


        _ready = true;
        base.Update();
    }
Ejemplo n.º 2
0
    private void Update()
    {
        if (!_ready)
        {
            CustomEventManager.Instance().SubscribeMouse(GetComponent <BoxCollider>(), HandleClick, HandleDrag, HandleDrop);
        }

        _ready = true;
    }