コード例 #1
0
    /* private void Update()
     * {
     *   if (vibrationCountdown > 0 && isVibrating)
     *   {
     *       input.Vibrate(0.5f, 0.5f);
     *       vibrationCountdown -= Time.deltaTime;
     *   }
     *   else
     *   {
     *       input.Vibrate(0.0f, 0.0f);
     *       isVibrating = false;
     *       vibrationCountdown = VibrationTime;
     *   }
     *
     *   if (cooldownCountdown > 0)
     *   {
     *       //r.color = new Color(1, 1, 1, 1);
     *       cooldownCountdown -= Time.deltaTime;
     *   }
     *   else
     *   {
     *       //r.color = new Color(1, 1, 1, 0);
     *   }
     * }*/

    private void FixedUpdate()
    {
        if (!actorPlayer.isStunned)
        {
            if (cooldownCountdown <= 0)
            {
                if (input.Fire1ButtonPress())
                {
                    anim.SetTrigger("Attack");
                    cooldownCountdown = cooldown;
                    damageCountdown   = damageDuration;
                }
            }
            else
            {
                cooldownCountdown -= Time.fixedDeltaTime;
                damageCountdown   -= Time.fixedDeltaTime;
            }
        }
        else
        {
            cooldownCountdown -= Time.fixedDeltaTime;
            damageCountdown   -= Time.fixedDeltaTime;
        }
    }