コード例 #1
0
    private void ProcessMovement()
    {
        if (canMove)
        {
            if (PInput.InputDir != Vector2.zero)
            {
                runTimer += Time.deltaTime;
                PAnimator.SetBool("IsMoving", true);
            }
            else
            {
                runTimer -= Time.deltaTime * deaccelFactor;
                PAnimator.SetBool("IsMoving", false);
            }
        }
        else
        {
            runTimer = 0;
            PAnimator.SetBool("IsMoving", false);
        }

        isMoving = PAnimator.GetBool("IsMoving");

        runTimer = Mathf.Clamp01(runTimer);

        //evaluate what our speed is according to the acceleration curve
        currentSpeed = accelCurve.Evaluate(runTimer) * moveSpeed;

        velocity  = (transform.forward * currentSpeed);
        velocity += Vector3.up * gravity;

        CharController.Move(velocity * Time.deltaTime);
    }
コード例 #2
0
 private void Update()
 {
     if (photonView.isMine)
     {
         if (PInput.WhackButton && PMovement.CanMove)
         {
             PAnimator.SetBool("Whack", true);
         }
     }
 }
コード例 #3
0
    /// <summary>
    /// Knocks the player down and become invincible for a short period of time
    /// </summary>
    public void Whacked()
    {
        isInvincible = true;
        PAnimator.SetBool("KnockedDown", true);
        hitStop.PlayHitStop();

        StartCoroutine("InvincibilityFlicker");
        StartCoroutine("ResetKnockedDown");
        //StartCoroutine("KnockAway", direction);
    }
コード例 #4
0
    private IEnumerator ResetKnockedDown()
    {
        float timer  = 0;
        float inTime = .5f;

        while (timer <= inTime)
        {
            timer += Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        PAnimator.SetBool("KnockedDown", false);
    }