コード例 #1
0
 public virtual void AttemptToConsumeItem(PlayerAnimatorManager playerAnimatorManager, WeaponSlotManager weaponSlotManager, PlayerFXManager playerFXManager)
 {
     if (currentAmount > 0)
     {
         playerAnimatorManager.PlayTargetAnimation(consumeAnimation, isInteracting, true);
     }
     else
     {
         playerAnimatorManager.PlayTargetAnimation("Potion Empty", true);
     }
 }
コード例 #2
0
        public override void AttemptToCastSpell(
            PlayerAnimatorManager animationHandler,
            PlayerStats playerStats,
            WeaponSlotManager weaponSlotManager)
        {
            base.AttemptToCastSpell(animationHandler, playerStats, weaponSlotManager);
            GameObject instantiatedWarmUpSpellFX = Instantiate(spellWarmUpFX, animationHandler.transform);

            animationHandler.PlayTargetAnimation(spellAnimation, true);
            Debug.Log("Casting Spell");
            Destroy(instantiatedWarmUpSpellFX, 2);
        }
コード例 #3
0
        public override void TakeDamage(int damage, string damageAnimation = "Damage_01")
        {
            if (playerManager.isInvulnerable)
            {
                return;
            }

            base.TakeDamage(damage, damageAnimation = "Damage_01");
            healthBar.SetCurrentHealth(CurrentHealth);
            animatorHandler.PlayTargetAnimation(damageAnimation, true);

            if (CurrentHealth <= 0)
            {
                CurrentHealth = 0;
                isDead        = true;
                animatorHandler.PlayTargetAnimation("Death_01", true);
                //Handle respawn

                gameManager.Respawn();
            }
        }
コード例 #4
0
        public void HandleRollingAndSprinting(float delta)
        {
            if (animatorHandler.anim.GetBool("isInteracting"))
            {
                return;
            }

            //Stamina dependency
            if (playerStats.CurrentStamina <= 0)
            {
                return;
            }

            if (inputHandler.isRolling)
            {
                moveDirection  = cameraObject.forward * inputHandler.vertical;
                moveDirection += cameraObject.right * inputHandler.horizontal;

                if (inputHandler.moveAmount > 0)
                {
                    animatorHandler.PlayTargetAnimation("Rolling", true);
                    moveDirection.y = 0;
                    Quaternion rollRotation = Quaternion.LookRotation(moveDirection);
                    myTransform.rotation = rollRotation;
                    playerStats.TakeStamina(rollStaminaCost);
                }
                else
                {
                    animatorHandler.PlayTargetAnimation("Backstep", true);
                    playerStats.TakeStamina(backStepStaminaCost);
                }
            }
        }
コード例 #5
0
        public override void AttemptToCastSpell(
            PlayerAnimatorManager animationHandler,
            PlayerStats playerStats,
            WeaponSlotManager weaponSlotManager)
        {
            base.AttemptToCastSpell(animationHandler, playerStats, weaponSlotManager);

            //instantiate the spell in the player's hand
            GameObject instantiatedWarmUpSpellFX = Instantiate(spellWarmUpFX, weaponSlotManager.rightHandSlot.transform);

            //The scale changes depends on preference
            instantiatedWarmUpSpellFX.gameObject.transform.localScale = new Vector3(1, 1, 1);

            //play animation
            animationHandler.PlayTargetAnimation(spellAnimation, true);
        }
コード例 #6
0
 public void OpenChestInteraction(Transform playerPosition)
 {
     playerLocomotion.rigidbody.velocity = Vector3.zero;
     transform.position = playerPosition.transform.position;
     playerAnimatorManager.PlayTargetAnimation("Open Chest", true);
 }
コード例 #7
0
        public void HandleWeaponCombo(Weapon weapon)
        {
            //Stamina dependency
            if (playerStats.CurrentStamina <= 0)
            {
                return;
            }

            if (inputHandler.comboFlag)
            {
                animatorHandler.anim.SetBool("canDoCombo", false);
                if (lastAttack == weapon.OH_Light_Attack_1)
                {
                    animatorHandler.PlayTargetAnimation(weapon.OH_Light_Attack_2, true);
                }
                else if (lastAttack == weapon.TH_Light_Attack_1)
                {
                    animatorHandler.PlayTargetAnimation(weapon.TH_Light_Attack_2, true);
                }
            }
        }