Exemple #1
0
        void IStage.Update()
        {
            var second = _TimeCounter.Second;
            var poly   = _Caster.FindDetermination(_CurrentCastTime, second);

            _CurrentCastTime = second;

            if (poly != null)
            {
                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);

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

            if (_Caster.IsDone(second))
            {
                _Complete = true;
                DoneEvent();
            }
        }
Exemple #2
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);
            }
        }