Esempio n. 1
0
        private void _ToInjury(BehaviorCommand.Injury injury)
        {
            _ChangeStage(() =>
            {
                var ability = _Entity.FindAbility<IActorPropertyAbility>();

                if (ability != null && ability.Injury(injury.Value, Regulus.Utility.Random.Next(20, 40)))
                {
                    _EntityAct(new Serializable.ActionCommand() { Command = ActionStatue.Injury, Turn = false, Direction = injury.Direction , Speed = 7 , Absolutely = true , Time = LocalTime.Instance.Ticks });
                }
                else
                    _EntityAct(new Serializable.ActionCommand() { Command = ActionStatue.Injury, Turn = true });

                var idle = new InjuryToIdleBehaviorHandler(1);
                var knockout = new KnockoutBehaviorHandler(_Entity);

                idle.DoneEvent += _ToIdle;
                knockout.DoneEvent += _ToKnockout;

                return new IBehaviorHandler[] { knockout, idle };
            });
        }
Esempio n. 2
0
        private void _ToIdle()
        {
            _ChangeStage(() =>
            {
                var move = new MoveBehaviorHandler(_Entity);
                var injury = new IdleToInjuryBehaviorHandler(_Entity);
                var skill = new IdleToSkillBehaviorHandler(_Entity);
                var knockout = new KnockoutBehaviorHandler(_Entity);

                injury.DoneEvent += _ToInjury;
                move.MoveEvent += _ToMove;
                skill.SkillEvent += _ToSkill;
                knockout.DoneEvent += _ToKnockout;
                var actor = _Entity.FindAbility<IActorPropertyAbility>();
                actor.EndExpendEnergy();
                _EntityAct(new Serializable.ActionCommand() { Command = ActionStatue.Idle_1, Turn = true } );
                return new IBehaviorHandler[] { injury, move, skill, knockout };
            });
        }