Exemplo n.º 1
0
 public void PaladinDamage()
 {
     if (states != null)
     {
         SpiritSystem spiritSystem = GetComponentInParent <SpiritSystem>();
         spiritSystem.PaladinDamage();
     }
 }
Exemplo n.º 2
0
 public void ClericHealing()
 {
     if (states != null)
     {
         SpiritSystem spiritSystem = GetComponentInParent <SpiritSystem>();
         spiritSystem.ClericHealing();
     }
 }
Exemplo n.º 3
0
        private void Awake()
        {
            playerStateManager = GetComponentInParent <StateManager>();
            playerSpiritSystem = GetComponentInParent <SpiritSystem>();

            if (playerStateManager)
            {
                damage     = playerStateManager.damage;
                baseDamage = damage;
            }
            else if (GetComponentInParent <Enemy>())
            {
                damage     = GetComponentInParent <Enemy>().damage;
                critDamage = GetComponentInParent <Enemy>().critDamage;
                critChance = GetComponentInParent <Enemy>().critChance;
            }
        }
Exemplo n.º 4
0
        protected virtual void Start()
        {
            if (UI == null)
            {
                UI = FindObjectOfType <CardUISystem>();
            }
            selected = false;

            if (spiritSystem == null)
            {
                spiritSystem = FindObjectOfType <SpiritSystem>();
            }

            shadow = FindObjectOfType <UIShadow>();

            shadow.effectColor = new Color(shadow.effectColor.r, shadow.effectColor.g, shadow.effectColor.b, 0);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Listens for inputs from the player if no other inputs are already true, returns and applies corresponding action based on input received.
        /// </summary>
        public void DetectAction()
        {
            AnimationClip desiredAnimation = null;
            Action        slot             = null;

            if (!lightAttack && !dodgeRoll && !block && !specialAttack) // If there are no actions detected...
            {
                return;
            }

            if (block && lightAttack && !inAction && shieldBashTimer < Time.time)
            {
                shieldBashTimer    = Time.time + shieldBashCooldown;
                animationClipIndex = 0;                  // Reset array position
                listenForCombos    = false;
                charAnim.CrossFade("ParryShield", 0.2f); // Apply animation crossfade.
                return;
            }

            if (listenForCombos)                          // If we are listening for a combo input and are not in the middle of a combo...
            {
                slot = actionManager.GetActionSlot(this); // Return action that matches input

                if (slot == null)                         // If there is nothing to return...
                {
                    return;
                }
                else
                {
                    listenForCombos  = false;
                    desiredAnimation = slot.desiredAnimation;
                }

                if (specialAttack && !inAction)
                {
                    listenForCombos = false;
                    SpiritSystem spiritSystem = GetComponent <SpiritSystem>();
                    if (!spiritSystem.CheckAbilityCooldown())
                    {
                        return;
                    }
                    spiritSystem.ActiveAbility(spiritSystem.spiritEquipped);
                    animationClipIndex = 0;
                }

                // Light Attack Combo
                if (slot.desiredAnimation == lightAttacksChain[0])
                {
                    animationClipIndex++;

                    if (animationClipIndex >= lightAttacksChain.Length) // Array bounds check
                    {
                        animationClipIndex = 0;                         // Reset array position
                    }

                    desiredAnimation = lightAttacksChain[animationClipIndex]; // Set animation to call
                }
                // Block mid combo
                else if (desiredAnimation.name == "block")
                {
                    animationClipIndex = 0; // Reset array position
                    isBlocking         = true;
                    charAnim.SetBool("blocking", isBlocking);
                    charAnim.SetBool("canMove", true);
                    canMove = true;
                    //actionLockoutDuration = 0.3f;
                    return;
                }
                else if (desiredAnimation.name == "DodgeRoll")
                {
                    HandleDodgeRoll();
                    animationClipIndex = 0;
                    return;
                }

                if (desiredAnimation == null) // If desiredAnimation returns nothing...
                {
                    print("No animation of " + desiredAnimation + " found, is this the correct animation to search for?");
                    return;
                }

                canMove  = false;
                inAction = true;

                if (lockOn)
                {
                    RotateTowardsTarget(lockOnTarget.transform);
                }

                charAnim.CrossFade(desiredAnimation.name, 0.2f); // Crossfade from current animation to the desired animation.
                return;
            }

            // -----------

            if (!canMove) // If the player can't move (Such as mid roll, staggered from a hit, etc.)
            {
                return;
            }

            slot = actionManager.GetActionSlot(this); // Return action that matches input

            if (slot == null)                         // If there is nothing to return...
            {
                return;
            }
            else
            {
                desiredAnimation = slot.desiredAnimation;
            }

            if (specialAttack && !inAction)
            {
                SpiritSystem spiritSystem = GetComponent <SpiritSystem>();
                if (!spiritSystem.CheckAbilityCooldown())
                {
                    return;
                }
                spiritSystem.ActiveAbility(spiritSystem.spiritEquipped);
            }

            if (desiredAnimation == null)
            {
                return;
            }

            if (desiredAnimation.name == "block")
            {
                isBlocking = true;
                charAnim.SetBool("blocking", isBlocking);
                canMove = true;
                charAnim.SetBool("canMove", true);
                //actionLockoutDuration = 0.3f;
                return;
            }
            else if (desiredAnimation.name == "DodgeRoll")
            {
                HandleDodgeRoll();
                animationClipIndex = 0;
                return;
            }

            if (string.IsNullOrEmpty(desiredAnimation.name)) // If desiredAnimation returns nothing...
            {
                print("No animation of " + desiredAnimation + " found, is this the correct animation to search for?");
                return;
            }

            //canMove = false;
            //inAction = true;

            if (!inAction)
            {
                if (lockOn)
                {
                    RotateTowardsTarget(lockOnTarget.transform);
                }

                charAnim.CrossFade(desiredAnimation.name, 0.2f); // Apply animation crossfade.
            }
        }