bool CheckSkillCD(SkillInfoAgent skillInfo)
 {
     if (!skillInfo.isCD && !skillInfo.usableWhenInCD)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
 bool CheckSkillCD(SkillInfoAgent skillInfo)
 {
     if (PlayerInfoManager.Instance.PlayerInfo.Current_MP - skillInfo.subMP < 0 || skillInfo.skillLevel <= 0 || (!skillInfo.isCD && !skillInfo.usableWhenInCD))
     {
         return(false);
     }
     return(true);
 }
Пример #3
0
 public void ShowSkillInfo(SkillInfoAgent skillInfoAgent)
 {
     DesIcon.overrideSprite = skillInfoAgent.Icon.overrideSprite;
     DesName.text           = skillInfoAgent.skillName;
     DesText.text           = skillInfoAgent.description;
     levelUp.onClick.RemoveAllListeners();
     MyTools.SetActive(levelUp.gameObject, true);
     currentCD.text  = skillInfoAgent.coolDownTime + "秒";
     currentSub.text = skillInfoAgent.subMP + "";
     if (skillInfoAgent.skillLevel >= 10)
     {
         currentLevel.text    = nextLevel.text = "登峰造极";
         levelUp.interactable = false;
         nextCD.text          = skillInfoAgent.coolDownTime + "秒";
         nextSub.text         = skillInfoAgent.subMP + "";
         currentEffect.text   = nextEffect.text = skillInfoAgent.GetEffectText(false);
     }
     else if (skillInfoAgent.skillLevel > 0)
     {
         currentLevel.text  = skillInfoAgent.skillLevel + "段";
         nextLevel.text     = (skillInfoAgent.skillLevel + 1) + "段";
         nextCD.text        = skillInfoAgent.coolDownTime - skillInfoAgent.Sub_CD + "秒";
         nextSub.text       = skillInfoAgent.subMP + skillInfoAgent.Add_Sub + "";
         currentEffect.text = skillInfoAgent.GetEffectText(false);
         nextEffect.text    = skillInfoAgent.GetEffectText(true);
         if (PlayerInfoManager.Instance.PlayerInfo.SkillPointOne < 1)
         {
             levelUp.interactable = false;
         }
         else
         {
             levelUp.onClick.AddListener(skillInfoAgent.OnLevelUp);
             levelUp.interactable = true;
         }
     }
     else
     {
         currentLevel.text  = "未学习";
         nextLevel.text     = (skillInfoAgent.skillLevel + 1) + "段";
         nextCD.text        = skillInfoAgent.coolDownTime + "秒";
         nextSub.text       = skillInfoAgent.subMP + "";
         currentEffect.text = nextEffect.text = skillInfoAgent.GetEffectText(false);
         if (PlayerInfoManager.Instance.PlayerInfo.SkillPointOne < 1)
         {
             levelUp.interactable = false;
         }
         else
         {
             levelUp.onClick.AddListener(skillInfoAgent.OnLevelUp);
             levelUp.interactable = true;
         }
     }
     if (skillInfoAgent.isNormalAtk)
     {
         MyTools.SetActive(levelUp.gameObject, false);
     }
 }
    public void Attack03()
    {
        if (!enemyLocomotionAgent.enemyInfoAgent.IsFighting || !enemyLocomotionAgent.enemyInfoAgent.IsAlive)
        {
            return;
        }
        SkillInfoAgent skillToUse = skills.Find(s => s.skillID.Substring(s.skillID.Length - 2) == "03");

        if (!skillToUse)
        {
            return;
        }
        if (CheckSkillCD(skillToUse))
        {
            enemyLocomotionAgent.enemyAnima.SetTrigger(Animator.StringToHash("Attack3"));
        }
    }
Пример #5
0
    public void BeAttack(PlayerInfo playerInfo, SkillInfoAgent skillInfo, bool hurtForwad)
    {
        DamageType damageType;
        StatuInfo  statuInfo;
        int        damageValue = MyTools.GetDamaged(false, playerInfo, this, skillInfo, out damageType, out statuInfo, hurtForwad);

        //Debug.Log("Enemy is hurt:" + damageType + "||" + damageValue);
        Current_HP -= damageValue;
        if (statuInfo.Statu != Statu.None)
        {
            if (SetStatu(statuInfo))
            {
                switch (statuInfo.Statu)
                {
                case Statu.Falled: HUDTextManager.Instance.NewStatu(transform, Statu.Falled); break;

                case Statu.Giddy: HUDTextManager.Instance.NewStatu(transform, Statu.Giddy); break;

                case Statu.Rigidity: HUDTextManager.Instance.NewStatu(transform, Statu.Rigidity); break;
                }
                HUDTextManager.Instance.NewStatu(transform, statuInfo.Statu);
            }
        }
        switch (damageType)
        {
        case DamageType.Miss:
            HUDTextManager.Instance.NewMiss(transform); break;

        case DamageType.HurtBackward:
            HUDTextManager.Instance.NewBackDamageValue(transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                enemyLocmAgent.SetEnemyHurtAnima();
            }
            if (hitEffectPrefab)
            {
                ObjectPoolManager.Instance.Get(hitEffectPrefab, transform.position + Vector3.up * hitEffectHeight, transform.rotation);
            }
            enemyAudioAgent.HitSound();
            enemyAudioAgent.DamageVoice();
            break;

        case DamageType.BlockBroken:
            HUDTextManager.Instance.NewBlockBroken(transform);
            SetStatu(new StatuInfo(Statu.BlockBroken, 5));
            enemyAudioAgent.HitSound();
            enemyAudioAgent.DamageVoice();
            break;

        case DamageType.Block:
            HUDTextManager.Instance.NewBlock(transform); break;

        case DamageType.Crit:
            HUDTextManager.Instance.NewCritDamageValue(transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                enemyLocmAgent.SetEnemyHurtAnima();
            }
            enemyAudioAgent.HitSound();
            enemyAudioAgent.DamageVoice();
            break;

        default:
            HUDTextManager.Instance.NewDamageValue(transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                enemyLocmAgent.SetEnemyHurtAnima();
            }
            if (hitEffectPrefab)
            {
                ObjectPoolManager.Instance.Get(hitEffectPrefab, transform.position + Vector3.up * hitEffectHeight, transform.rotation);
            }
            enemyAudioAgent.HitSound();
            enemyAudioAgent.DamageVoice();
            break;
        }
        IsFighting = true;
        if (isBoss)
        {
            HUDTextManager.Instance.SetBossHPBar(this);
        }
        if (!IsAlive)
        {
            StartCoroutine(OnDeath());
        }
    }
Пример #6
0
 public static int GetDamaged(bool forPlayer, PlayerInfo player, EnemyInfoAgent enemy, SkillInfoAgent skillInfo, out DamageType damageType, out StatuInfo statuInfo, bool hurtForward)
 {
     if (!enemy || !skillInfo)
     {
         Debug.Log(skillInfo);
         damageType = DamageType.Miss;
         statuInfo  = new StatuInfo(Statu.None, 0);
         return(0);
     }
     statuInfo = new StatuInfo(Statu.None, 0);
     if (!forPlayer)
     {
         if (!Probability(80 + player.Hit - enemy.Dodge - player.Level - enemy.Level))
         {
             damageType = DamageType.Miss; return(0);
         }
         damageType = DamageType.Hit;
         float finallyValue = (player.ATK - enemy.DEF * (skillInfo.isCD ? skillInfo.attackMultiple / 100 : (skillInfo.attackMultiple * (1 - skillInfo.subMultiple * 0.01f) / 100)));
         //Debug.Log(skillInfo.attackMultiple * (1 - skillInfo.subMultiple * 0.01f) / 100);
         finallyValue = finallyValue > 1 ? finallyValue : 1;
         if (enemy.IsDown /*|| player.IsFloat*/ || !hurtForward)
         {
             finallyValue *= 2;
             if (!hurtForward)
             {
                 damageType = DamageType.HurtBackward;
             }
         }
         else if (enemy.IsGiddy)
         {
             finallyValue = finallyValue * 1.5f;
         }
         if (Probability((20 + enemy.Crit) < 60 ? (20 + enemy.Crit) : 60))
         {
             finallyValue *= 2; damageType = DamageType.Crit;
         }
         if (enemy.IsBlocking && hurtForward)
         {
             damageType = DamageType.Block;
             enemy.Current_BlockAmount -= System.Convert.ToInt32(finallyValue);
             if (enemy.Current_BlockAmount == 0)
             {
                 damageType = DamageType.BlockBroken;
             }
             return(0);
         }
         if (skillInfo.statuEffcted && skillInfo.isCDWhenUse)
         {
             statuInfo.Statu    = skillInfo.attachStatu;
             statuInfo.Duration = skillInfo.statuDuration;
         }
         if (skillInfo.isCDWhenUse)
         {
             player.Current_HP += skillInfo.recHPWhenHit;
             player.Current_MP += skillInfo.recMPWhenHit;
         }
         return(System.Convert.ToInt32(finallyValue));
     }
     else
     {
         if (!Probability(80 + enemy.Hit - player.Dodge - enemy.Level - player.Level))
         {
             damageType = DamageType.Miss; return(0);
         }
         damageType = DamageType.Hit;
         float finallyValue = (enemy.ATK - player.DEF * (skillInfo.isCD ? skillInfo.attackMultiple / 100 : (skillInfo.attackMultiple * (1 - skillInfo.subMultiple * 0.01f) / 100)));
         finallyValue = finallyValue > 1 ? finallyValue : 1;
         if (player.IsDown /*|| player.IsFloat*/ || !hurtForward)
         {
             finallyValue *= 2;
             if (!hurtForward)
             {
                 damageType = DamageType.HurtBackward;
             }
         }
         else if (player.IsGiddy)
         {
             finallyValue = finallyValue * 1.5f;
         }
         if (Probability((20 + player.Crit) < 60 ? (20 + player.Crit) : 60))
         {
             finallyValue *= 2; damageType = DamageType.Crit;
         }
         if (player.IsBlocking && hurtForward)
         {
             damageType                  = DamageType.Block;
             player.Current_MP          += System.Convert.ToInt32(player.MP * 0.05f);
             player.Current_BlockAmount -= System.Convert.ToInt32(finallyValue);
             if (player.Current_BlockAmount == 0)
             {
                 damageType = DamageType.BlockBroken;
             }
             return(0);
         }
         if (skillInfo.statuEffcted)
         {
             statuInfo.Statu    = skillInfo.attachStatu;
             statuInfo.Duration = skillInfo.statuDuration;
         }
         return(System.Convert.ToInt32(finallyValue));
     }
 }
    public void BeAttack(EnemyInfoAgent enermyInfoAgent, SkillInfoAgent skillInfo, bool hurtForwad)
    {
        if (PlayerInfo == null || !PlayerInfo.IsAlive)
        {
            return;
        }
        DamageType damageType;
        StatuInfo  statuInfo;
        int        damageValue = MyTools.GetDamaged(true, PlayerInfo, enermyInfoAgent, skillInfo, out damageType, out statuInfo, hurtForwad);

        //Debug.Log("Pleyer is hurt:" + damageType + "||" + damageValue);
        PlayerInfo.Current_HP -= damageValue;
        if (statuInfo.Statu != Statu.None)
        {
            if (SetStatu(statuInfo))
            {
                switch (statuInfo.Statu)
                {
                case Statu.Falled:  break;

                case Statu.Giddy:  break;

                case Statu.Rigidity:
                    PlayerLocomotionManager.Instance.playerAnima.speed           = 0;
                    PlayerLocomotionManager.Instance.playerController.moveAble   = false;
                    PlayerLocomotionManager.Instance.playerController.rotateAble = false;
                    break;
                }
                HUDTextManager.Instance.NewStatu(Player.transform, statuInfo.Statu);
            }
        }
        switch (damageType)
        {
        case DamageType.Miss:
            HUDTextManager.Instance.NewMiss(Player.transform);
            PlayerLocomotionManager.Instance.SetPlayerMissAnima(); break;

        case DamageType.HurtBackward:
            HUDTextManager.Instance.NewBackDamageValue(Player.transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                PlayerLocomotionManager.Instance.SetPlayerHurtAnima();
            }
            break;

        case DamageType.BlockBroken:
            HUDTextManager.Instance.NewBlockBroken(Player.transform);
            SetStatu(new StatuInfo(Statu.BlockBroken, 5)); break;

        case DamageType.Block:
            HUDTextManager.Instance.NewBlock(Player.transform); break;

        case DamageType.Crit:
            HUDTextManager.Instance.NewCritDamageValue(Player.transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                PlayerLocomotionManager.Instance.SetPlayerHurtAnima();
            }
            break;

        default:
            HUDTextManager.Instance.NewDamageValue(Player.transform, damageValue);
            if (statuInfo.Statu == Statu.None)
            {
                PlayerLocomotionManager.Instance.SetPlayerHurtAnima();
            }
            break;
        }
        if (PlayerWeaponManager.Instance.currentWeaponTag == string.Empty)
        {
            PlayerInfo.IsFighting = false;
        }
        else
        {
            PlayerInfo.IsFighting = true;
        }
        if (!PlayerInfo.IsAlive)
        {
            MyTools.SetActive(reliveWindow, true);
        }
    }
Пример #8
0
    public void UseSkill()
    {
        int            SkillID     = -1;
        SkillInfoAgent skillToUsed = null;

#if UNITY_ANDROID
        if (CrossPlatformInputManager.GetButton("Skill0") || (CrossPlatformInputManager.GetButton("Fire1") && CameraFollow.Camera.rotateAble))
        {
            SkillID = 0;
            if (skillsStore[0])
            {
                skillToUsed = skillsStore[0];
            }
        }
        if (CrossPlatformInputManager.GetButton("Skill1"))
        {
            SkillID = 1;
            if (skillsStore[1])
            {
                skillToUsed = skillsStore[1];
            }
        }
        if (CrossPlatformInputManager.GetButton("Skill2"))
        {
            SkillID = 2;
            if (skillsStore[2])
            {
                skillToUsed = skillsStore[2];
            }
        }
        if (CrossPlatformInputManager.GetButton("Skill3"))
        {
            SkillID = 3;
            if (skillsStore[3])
            {
                skillToUsed = skillsStore[3];
            }
        }
        if (CrossPlatformInputManager.GetButton("Skill4"))
        {
            SkillID = 4;
            if (skillsStore[4])
            {
                skillToUsed = skillsStore[4];
            }
        }
#else
        if (Input.GetButton("Skill0") || (Input.GetButton("Fire1") && CameraFollow.Camera.rotateAble))
        {
            SkillID = 0;
            if (skillsStore[0])
            {
                skillToUsed = skillsStore[0];
            }
        }
        if (Input.GetButton("Skill1"))
        {
            SkillID = 1;
            if (skillsStore[1])
            {
                skillToUsed = skillsStore[1];
            }
        }
        if (Input.GetButton("Skill2"))
        {
            SkillID = 2;
            if (skillsStore[2])
            {
                skillToUsed = skillsStore[2];
            }
        }
        if (Input.GetButton("Skill3"))
        {
            SkillID = 3;
            if (skillsStore[3])
            {
                skillToUsed = skillsStore[3];
            }
        }
        if (Input.GetButton("Skill4"))
        {
            SkillID = 4;
            if (skillsStore[4])
            {
                skillToUsed = skillsStore[4];
            }
        }
#endif
        if (skillToUsed)
        {
            if (CheckSkillCD(skillToUsed))
            {
                PlayerLocomotionManager.Instance.playerAnima.SetInteger(SkillIDHash, SkillID);
            }
            else
            {
                PlayerLocomotionManager.Instance.playerAnima.SetInteger(SkillIDHash, -1);
            }
        }
        else
        {
            PlayerLocomotionManager.Instance.playerAnima.SetInteger(SkillIDHash, -1);
        }
        if (CrossPlatformInputManager.GetButtonDown("Dodge") && PlayerInfoManager.Instance.PlayerInfo.Current_MP > 50)
        {
            PlayerLocomotionManager.Instance.SetDodge();
        }
    }