Exemplo n.º 1
0
    public void startMovement(Interactable.States state)
    {
        currentState = state;

        currentXPosition = transform.position.x;

        startTime = Time.time;
    }
Exemplo n.º 2
0
    public void activateDummyTorch()
    {
        currentState = Interactable.States.Active;

        if (!glow.isActive())
        {
            glow.startGlow();
        }

        lightTimer = setLightTimer;
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (currentState == Interactable.States.Active)
        {
            float t = (Time.time - startTime) / moveDuration;

            if (t > 1)
            {
                currentState = Interactable.States.Rest;


                if (dTrigger != null)
                {
                    dTrigger.enabled = false;
                }

                foreach (GameObject simDTrigger in simDTriggers)
                {
                    simDTrigger.GetComponent <SpriteRenderer>().enabled = false;

                    if (simDTrigger.GetComponent <ParticleSystem>() != null)
                    {
                        simDTrigger.GetComponent <ParticleSystem>().Stop();
                    }
                }

                enabled = false;
            }
            else
            {
                transform.position = new Vector3(transform.position.x, Mathf.SmoothStep(currentYPosition, newYPosition, t), 0);
            }
        }
        else if (currentState == Interactable.States.Deactivate)
        {
            float t = (Time.time - startTime) / moveDuration;

            if (t > 1)
            {
                currentState = Interactable.States.Rest;
            }
            else
            {
                transform.position = new Vector3(transform.position.x, Mathf.SmoothStep(currentYPosition, startYPosition, t), 0);
            }
        }
        else
        {
            return;
        }
    }
Exemplo n.º 4
0
    public void Update()
    {
        if (currentState == Interactable.States.Active)
        {
            lightTimer -= Time.deltaTime;

            if (lightTimer <= 0f)
            {
                glow.disableGlow();

                currentState = Interactable.States.Rest;
                torchTrigger.enableRest();
            }
        }
    }