예제 #1
0
        private void CaseAttackStateNone()
        {
            Skill skillPrepared = null;

            foreach (Skill skill in skillList)
            {
                if (skill.IsSkillPrepared())
                {
                    skillPrepared = skill;
                    break;
                }
            }
            Skill skillPreparedExceptCooltime = null;

            if (skillPrepared == null)
            {
                foreach (Skill skill in skillList)
                {
                    ICooldownable cSkill = skill as ICooldownable;
                    if (cSkill != null && cSkill.IsSkillReadyExceptCooldown())
                    {
                        skillPreparedExceptCooltime = skill;
                        break;
                    }
                }
            }

            //if there exist any usable skill
            if (skillPrepared != null)
            {
                skillFocused = skillPrepared;
                moveState    = MoveState.idle;
                ICastable  cSkill = skillPrepared as ICastable;
                IReadiable rSkill = skillPrepared as IReadiable;
                if (cSkill != null && !cSkill.IsCastExempted)
                {
                    SetAttackState(AttackState.cast);
                }
                else if (rSkill != null && !rSkill.IsReadyExempted)
                {
                    SetAttackState(AttackState.ready);
                }
                else
                {
                    SetAttackState(AttackState.attack);
                }
            }
            else if (skillPreparedExceptCooltime != null)
            {
                SetMoveState(MoveState.idle);
                SetAttackState(AttackState.none);
            }
            else
            {
                SetMoveState(MoveState.walk);
                SetAttackState(AttackState.none);
            }
        }
예제 #2
0
        private void CaseAttackStateReady()
        {
            IReadiable skill  = skillFocused as IReadiable;
            Hashtable  action = new Hashtable();

            if (skill.IsReadyCompleted() || skill.IsReadyExempted)
            {
                SetAttackState(AttackState.attack);
            }
            else
            {
                skill.Ready(action);
            }
        }
예제 #3
0
        public void PrintDetail()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("\n=======================\n        ");
            sb.Append(this.ToString());
            sb.Append("\n=======================\n");
            sb.Append("\nSkill focused : ");
            if (skillFocused != null)
            {
                sb.Append(skillFocused.skillCode);
            }
            sb.Append("\nAttack state : ");
            sb.Append(attackState);
            sb.Append("\nMove state : ");
            sb.Append(moveState);
            for (int i = 0; i < skillList.Count; i++)
            {
                sb.Append("\n--Skill");
                sb.Append(i);
                sb.Append("--");
                sb.Append("\nSkill name : ");
                sb.Append(skillList[i].skillCode);
                sb.Append("\nSkill Cooldown : ");
                ICooldownable cSkill = skillList[i] as ICooldownable;
                if (cSkill != null)
                {
                    sb.Append(cSkill.CooldownTime + "/" + cSkill.CooldownTimeNeeded);
                    if (cSkill.IsSkillReadyExceptCooldown())
                    {
                        sb.Append(": Skill Ready Except Cooldown");
                    }
                }
                else
                {
                    sb.Append("Not Cooldownable");
                }
                sb.Append("\nSkill Ready : ");
                IReadiable rSkill = skillList[i] as IReadiable;
                if (rSkill != null)
                {
                    sb.Append(rSkill.ReadyTime + "/" + rSkill.ReadyTimeNeeded);
                }
                else
                {
                    sb.Append("Not Readiable");
                }
                sb.Append("\nSkill Delay : ");
                IDelayable dSkill = skillList[i] as IDelayable;
                if (dSkill != null)
                {
                    sb.Append(dSkill.DelayTime + "/" + dSkill.DelayTimeNeeded);
                }
                else
                {
                    sb.Append("Not Delayable");
                }
            }
            sb.Append("\n=======================");
            Console.WriteLine(sb);
        }