Exemplo n.º 1
0
 void CancelCoroutine(Coroutine coroutine, bool finished, SetFinished setFinished)
 {
     if (coroutine != null && !finished)
     {
         StopCoroutine(coroutine);
         setFinished(true);
     }
 }
Exemplo n.º 2
0
 void CancelCoroutine(Coroutine coroutine, bool finished, SetFinished setFinished, string animationTrigger)
 {
     if (coroutine != null && !finished)
     {
         StopCoroutine(coroutine);
         setFinished(true);
         p_Animator.SetTrigger(animationTrigger);
     }
 }
Exemplo n.º 3
0
    IEnumerator TurnTowardsPointAndAct(Vector3 point, SetFinished finishedTurning, PlayerAction action)
    {
        finishedTurning(false);

        Quaternion lookRotation   = Quaternion.LookRotation(point - transform.position);
        Quaternion targetRotation = new Quaternion(transform.rotation.x, lookRotation.y, transform.rotation.z, lookRotation.w);

        while (Mathf.Abs(Quaternion.Dot(transform.rotation, targetRotation)) < 0.98f)
        {
            transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, turnSpeed);
            yield return(null);
        }
        yield return(new WaitForSeconds(0.01f));

        finishedTurning(true);
        action();
    }
Exemplo n.º 4
0
    IEnumerator ThrowCoinRoutine(SetFinished finishedThrowing)
    {
        finishedThrowing(false);

        p_Animator.SetTrigger("Throw");

        yield return(new WaitForSeconds(coinThrowDelay));

        coinsRemaining--;
        Instantiate(coinPrefab, coinTarget, Quaternion.identity);
        AudioManager.Instance.PlaySFX(coinSound, 18f);

        GuardAI[] guards = GameObject.FindObjectsOfType <GuardAI>();
        foreach (GuardAI guard in guards)
        {
            guard.CoinDroppedAtPoint(coinTarget);
        }

        finishedThrowing(true);
    }
 public Task Handle(SetFinished message, CancellationToken token)
 {
     _store.AddSetWin(message.Id, message.Winner);
     return(Task.CompletedTask);
 }