public void Move()
    {
        move = false;
        BoulderMovement movement = movements[currMovement];
        Vector3         endPos   = transform.position + movement.offset;

        Coroutine rotation = null;

        rotation = StartCoroutine(MovementUtils.SmoothRotationConst(boulder, Vector3.back, movement.rotSpeed));

        StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
            if (rotation != null)
            {
                StopCoroutine(rotation);
            }
            if (!movement.onGround)
            {
                PlaySoundInterval(impactAudio, 0, 0.5f);
            }
            currMovement++;
            move = true;
        }, gameObject, endPos, movement.speed));

        //Play or dust ps
        if (movement.onGround)
        {
            rollingAudio.Play();
            dust.Play();
        }
        else
        {
            rollingAudio.Stop();
            dust.Stop();
        }
    }
 public void Set()
 {
     StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
         trigger.SetActive(true);
         GameSound.Stop("ElevatorMovement");
     }, gameObject, setPosition, speed));
     GameSound.Play("ElevatorMovement");
 }
Esempio n. 3
0
    public void Move()
    {
        move = false;
        PlatformMovement movement = movements[currMovement];
        Vector3          endPos   = transform.position + movement.offset;

        StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
            move = true;
        }, gameObject, endPos, movement.speed));
    }
Esempio n. 4
0
    public void WallGoUp()
    {
        Vector3 targetPos = initPos + offset;

        if (movement != null)
        {
            StopCoroutine(movement);
        }
        movement = MovementUtils.SmoothMovement((bool end) => {
            movement = null;
        }, wallToRemove, targetPos, movementSpeed);
        StartCoroutine(movement);
    }
    public override void ExitAction()
    {
        if (movement != null)
        {
            StopCoroutine(movement);
        }

        movement = StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
            GameSound.Stop("ElevatorMovement");
            movement = null;
        }, platform, setPosition, speed));
        GameSound.Play("ElevatorMovement");
    }
Esempio n. 6
0
 public override void ExitAction()
 {
     if (movement != null)
     {
         StopCoroutine(movement);
     }
     movement = MovementUtils.SmoothMovement((bool end) => {
         //Reset gem shader
         gemRend.material.shader = initGemShader;
         gemRend.material.SetColor("_EmissionColor", initGemEmissionColor);
         movement = null;
     }, gameObject, initPos, movementSpeed);
     StartCoroutine(movement);
 }
Esempio n. 7
0
    public override void Action()
    {
        Vector3 targetPos = initPos + offset;

        //Make gem glow
        gemRend.material.shader = glowGemShader;
        gemRend.material.SetColor("_EmissionColor", gemEmissionColor);
        if (movement != null)
        {
            StopCoroutine(movement);
        }
        movement = MovementUtils.SmoothMovement((bool end) => {
            movement = null;
        }, gameObject, targetPos, movementSpeed);
        StartCoroutine(movement);
    }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        if (!active)
        {
            return;
        }

        if (ready && down)
        {
            ready = false;
            down  = false;

            //Activate
            StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
                StartCoroutine(Deactivate());
            }, spikes, upPos, speed));
            spikeRisingAudio.Play();

            StartCoroutine(WaitCoolDown());
        }
    }
Esempio n. 9
0
 protected IEnumerator SmoothMovement(System.Action <bool> done, Vector3 end, float inverseMoveTime)
 {
     return(MovementUtils.SmoothMovement(done, gameObject, end, inverseMoveTime));
 }
Esempio n. 10
0
    public void Open()
    {
        Vector3 targetPos = initPos + offset;

        StartCoroutine(MovementUtils.SmoothMovement((bool end) => {}, gameObject, targetPos, movementSpeed));
    }
Esempio n. 11
0
    IEnumerator Deactivate()
    {
        yield return(new WaitForSeconds(upTime));

        StartCoroutine(MovementUtils.SmoothMovement((bool done) => { down = true; }, spikes, downPos, speed));
    }