Exemplo n.º 1
0
        /// <summary>
        /// Bow Attack Mode
        /// </summary>
        protected virtual void BowAttack(IBow Bow)
        {
            if (RC.IsAiming)                                                                                          //Shoot arrows only when is aiming
            {
                bool isInRange = RC.Active_IMWeapon.RightHand ? RC.HorizontalAngle <0.5f : RC.HorizontalAngle> -0.5f; //Calculate the Imposible range to shoot

                if (!isInRange)
                {
                    isHolding = false;
                    HoldTime  = 0;
                    return;
                }

                if (RC.InputAttack1.GetInput && !isHolding)            //If Attack is pressed Start Bending for more Strength the Bow
                {
                    RC.SetAction(WeaponActions.Hold);
                    isHolding = true;
                    HoldTime  = 0;
                }

                if (RC.InputAttack1.GetInput && isHolding)             // //If Attack is pressed Continue Bending the Bow for more Strength the Bow
                {
                    HoldTime += Time.deltaTime;

                    if (HoldTime <= Bow.HoldTime + Time.deltaTime)
                    {
                        Bow.BendBow(HoldTime / Bow.HoldTime);    //Bend the Bow
                    }
                    RC.Anim.SetFloat(Hash.IDFloat, HoldTime / Bow.HoldTime);
                }

                if (!RC.InputAttack1.GetInput && isHolding)            //If Attack is Release Go to next Action and release the Proyectile
                {
                    var Knot = Bow.KNot;
                    Knot.rotation = Quaternion.LookRotation(RC.AimDirection); //Alingns the Knot and Arrow to the AIM DIRECTION before Releasing the Arrow

                    RC.SetAction(WeaponActions.Fire_Proyectile);              //Go to Action FireProyectile
                    isHolding = false;
                    HoldTime  = 0;
                    RC.Anim.SetFloat(Hash.IDFloat, 0);            //Reset Hold Animator Values
                    Bow.ReleaseArrow(RC.AimDirection);

                    Bow.BendBow(0);

                    RC.OnAttack.Invoke(RC.Active_IMWeapon);                 //Invoke the On Attack Event
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// If Attack is Released Go to next Action and release the Proyectile
        /// </summary>
        private void ReleaseArrow()
        {
            if (RC.IsAiming && RC.WeaponAction != WeaponActions.Fire_Proyectile && isHolding)       //If we are not firing any arrow then try to Attack with the bow
            {
                var Knot = Bow.KNot;
                Knot.rotation = Quaternion.LookRotation(RC.AimDirection); //Aligns the Knot and Arrow to the AIM DIRECTION before Releasing the Arrow

                RC.SetAction(WeaponActions.Fire_Proyectile);              //Go to Action FireProyectile
                isHolding = false;
                HoldTime  = 0;
                RC.Anim.SetFloat(Hash.IDFloat, 0);                        //Reset Hold Animator Values

                Bow.ReleaseArrow(RC.AimDirection);

                Bow.BendBow(0);

                RC.OnAttack.Invoke(RC.Active_IMWeapon);                 //Invoke the On Attack Event
            }
        }
Exemplo n.º 3
0
        /// <summary> If Attack is Released Go to next Action and release the Proyectile</summary>
        private void ReleaseArrow()
        {
            if (RC.Aim && RC.WeaponAction != WA.Fire_Proyectile && isHolding) //If we are not firing any arrow then try to Attack with the bow
            {
                Bow = RC.ActiveWeapon as IBow;                                //Store the Bow

                var Knot = Bow.KNot;
                Knot.rotation = Quaternion.LookRotation(RC.AimDirection); //Aligns the Knot and Arrow to the AIM DIRECTION before Releasing the Arrow

                RC.WeaponAction = WA.Fire_Proyectile;                     //Go to Action FireProyectile
                isHolding       = false;
                HoldTime        = 0;

                Bow.ReleaseArrow(RC.AimDirection);
                Bow.BendBow(0);
                Anim.SetFloat(RC.Hash_WHold, 0);            //Reset Hold Animator Values

                RC.OnAttack.Invoke(RC.ActiveWeapon);        //Invoke the On Attack Event
            }
        }