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"); }
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)); }
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"); }
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); }
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); }
// 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()); } }
protected IEnumerator SmoothMovement(System.Action <bool> done, Vector3 end, float inverseMoveTime) { return(MovementUtils.SmoothMovement(done, gameObject, end, inverseMoveTime)); }
public void Open() { Vector3 targetPos = initPos + offset; StartCoroutine(MovementUtils.SmoothMovement((bool end) => {}, gameObject, targetPos, movementSpeed)); }
IEnumerator Deactivate() { yield return(new WaitForSeconds(upTime)); StartCoroutine(MovementUtils.SmoothMovement((bool done) => { down = true; }, spikes, downPos, speed)); }