Exemple #1
0
 void IStage.Enter()
 {
     _DatumPosition = _Player.GetPosition();
     _Player.Aid();
     _Caster = SkillCaster.Build(ACTOR_STATUS_TYPE.AID);
     _TimeCounter.Reset();
 }
        private void _ToCast(SkillCaster caster)
        {
            var status = new BattleCasterStatus(_Binder, _Player, _Map, caster);

            status.NextEvent       += _ToCast;
            status.BattleIdleEvent += _ToBattle;
            status.DisarmEvent     += _ToDone;
            _SetStatus(status);
        }
Exemple #3
0
 public BattleCasterStatus(ISoulBinder binder, Entity player, IMapFinder map, SkillCaster caster)
 {
     _CastTimer      = new TimeCounter();
     _Attacked       = new HashSet <Guid>();
     _Binder         = binder;
     _Player         = player;
     _Map            = map;
     _Caster         = caster;
     _MoveController = new MoveController(player);
 }
Exemple #4
0
        void ICastSkill.Cast(ACTOR_STATUS_TYPE skill)
        {
            if (_Overdraft)
            {
                return;
            }


            _NextCaster = _Caster.FindNext(skill);
        }
Exemple #5
0
        private void _ToDamage()
        {
            var skill  = Resource.Instance.FindSkill(ACTOR_STATUS_TYPE.DAMAGE1);
            var caster = new SkillCaster(skill, new Determination(skill));
            var stage  = new BattleCasterStatus(_Binder, _Player, _Map, caster);

            stage.BattleIdleEvent += _ToBattle;
            stage.NextEvent       += _ToCast;
            _SetStatus(stage);
        }
        private void _ToDamage()
        {
            var skill     = _Player.Equipment.GetSkill();
            var skillData = Resource.Instance.FindSkill(skill.Injury);

            var caster = new SkillCaster(skillData, new Determination(skillData));
            var stage  = new BattleCasterStatus(_Binder, _Player, _Map, caster);

            stage.BattleIdleEvent += _ToBattle;
            stage.NextEvent       += _ToCast;
            _SetStatus(stage);
        }
Exemple #7
0
        public float GetTrunSpeed()
        {
            if (_MoveController != null)
            {
                var status = _Entiry.GetStatus();
                var skill  = Resource.Instance.FindSkill(status);
                var caster = new SkillCaster(skill, new Determination(skill));

                return(caster.GetTurnRight());
            }

            return(0);
        }
Exemple #8
0
        void IStage.Update()
        {
            var nowTime = _CastTimer.Second;

            var poly = _Caster.FindDetermination(_CurrentCastTime, nowTime);

            _CurrentCastTime = nowTime;


            bool guardImpact = false;

            _Player.SetBlock(false);
            if (poly != null)
            {
                if (_Caster.IsBlock())
                {
                    _Player.SetBlock(true);
                }

                var dir    = -_Player.Direction * ((float)Math.PI / 180f);
                var center = _DatumPosition;
                if (_Caster.IsControll())
                {
                    center = _Player.GetPosition();
                }

                poly.Rotation(dir, new Vector2());
                poly.Offset(center);

                #region UnityDebugCode
#if UNITY_EDITOR
                _DrawAll((from p in _Caster.Data.Lefts select Regulus.CustomType.Polygon.RotatePoint(p, new Vector2(), dir)).ToArray()
                         , (from p in _Caster.Data.Rights select Regulus.CustomType.Polygon.RotatePoint(p, new Vector2(), dir)).ToArray()
                         , new UnityEngine.Vector3(center.X, 0.5f, center.Y), UnityEngine.Color.blue);
                _Draw(poly, 0.5f, UnityEngine.Color.green);
#endif
                #endregion

                var results = _Map.Find(poly.Points.ToRect());

                foreach (var individual in results)
                {
                    if (individual.Id == _Player.Id)
                    {
                        continue;
                    }
                    var collision = Regulus.CustomType.Polygon.Collision(poly, individual.Mesh, new Vector2());
                    if (collision.Intersect)
                    {
                        var smash = _Caster.GetSmash();
                        var punch = _Caster.GetPunch();

                        if (smash > 0)
                        {
                            _AttachDamage(individual, smash);
                        }
                        else if (individual.IsBlock() == false && punch > 0)
                        {
                            _AttachDamage(individual, punch);
                        }
                        else if (individual.IsBlock() && punch > 0)
                        {
                            guardImpact = true;
                        }
                    }
                }
            }

            if (guardImpact)
            {
                NextEvent(SkillCaster.Build(ACTOR_STATUS_TYPE.GUARD_IMPACT));
            }
            else if (_Caster.IsDone(_CurrentCastTime))
            {
                if (_Overdraft)
                {
                    NextEvent(SkillCaster.Build(ACTOR_STATUS_TYPE.TIRED));
                }
                else
                {
                    BattleIdleEvent();
                }
            }
            else if (_Caster.CanNext(_CurrentCastTime) && _NextCaster != null)
            {
                NextEvent(_NextCaster);
            }
        }