Ejemplo n.º 1
0
 public override void Finish(ActionFinishHandler handler)
 {
     effect.Finish();
     target.paused = false;
     handler(null);
     base.Finish(handler);
 }
Ejemplo n.º 2
0
 public override void Start(ActionFinishHandler handler)
 {
     effect = new FrozenEffect(target.x, target.y, 0);
     bottomEffectLayer.elements.Add(effect);
     target.paused = true;
     handler(null);
     base.Start(handler);
 }
Ejemplo n.º 3
0
 public Presentation(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler = null)
 {
     bottomEffectLayer = (EffectLayer)Global.world.GetLayer("BottomEffectLayer");
     bottomEffects     = new List <Effect>();
     this.stage        = stage;
     this.user         = user;
     this.targetList   = targetList;
     this.handler      = handler;
 }
Ejemplo n.º 4
0
        public PresentationGroup(int length, BattleStage stage, FighterObject user, List <FighterObject> targetList,
                                 ActionFinishHandler handler)
        {
            list = new Presentation[length];
            for (int i = 0; i < length - 1; i++)
            {
                list[i] = new Presentation(stage, user, targetList);
            }
            list[length - 1] = new Presentation(stage, user, targetList, handler);

            for (int i = 0; i < length - 1; i++)
            {
                list[i].ConnectPresentation(list[i + 1]);
            }
        }
Ejemplo n.º 5
0
        public OrderMoveCircle ( Vector2 aimPos, float moveVel, IAIOrderServer orderServer, ActionFinishHandler finishHandler, bool stopCallFinish )
        {
            this.orderServer = orderServer;
            moveVel = Math.Min( Math.Max( -orderServer.MaxBackwardSpeed, moveVel ), orderServer.MaxForwardSpeed );
            Vector2 direction = orderServer.Direction;
            Line curVertice = MathTools.VerticeLine( new Line( orderServer.Pos, direction ), orderServer.Pos );
            Line midVertice = MathTools.MidVerLine( orderServer.Pos, aimPos );
            Vector2 center;
            if (!MathTools.InterPoint( curVertice, midVertice, out center ))
            {
                this.moveVel = moveVel;
                this.rotaVel = 0;
                float forward = Vector2.Dot( direction, aimPos - orderServer.Pos );
                this.length = Vector2.Distance( aimPos, orderServer.Pos ) * Math.Sign( forward );
            }
            else
            {
                float radius = Vector2.Distance( center, orderServer.Pos );

                float turnRight = MathTools.Vector2Cross( direction, aimPos - orderServer.Pos );

                if (orderServer.MaxRotaSpeed * radius < Math.Abs( moveVel ))
                {
                    this.moveVel = orderServer.MaxRotaSpeed * radius;
                    this.rotaVel = orderServer.MaxRotaSpeed * Math.Sign( turnRight );

                }
                else
                {
                    this.moveVel = moveVel;
                    this.rotaVel = moveVel / radius * Math.Sign( turnRight );
                }
                float ang = MathTools.AngBetweenVectors( orderServer.Pos - center, aimPos - center );
                bool inFront = Vector2.Dot( direction, aimPos - orderServer.Pos ) >= 0;
                if (moveVel > 0)
                {
                    if (inFront)
                    {
                        this.length = ang * radius;
                    }
                    else
                    {
                        this.length = (2 * MathHelper.Pi - ang) * radius;
                    }
                }
                else
                {
                    if (inFront)
                    {
                        this.length = -(2 * MathHelper.Pi - ang) * radius;
                    }
                    else
                    {
                        this.length = -ang * radius;
                    }
                }
            }

            this.finishHandler = finishHandler;
            this.stopCallFinish = stopCallFinish;
        }
Ejemplo n.º 6
0
 public OrderMoveCircle ( float length, float rotaVel, float moveVel, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.length = length;
     this.rotaVel = rotaVel;
     this.moveVel = moveVel;
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 移动到目标点。
 /// 与OrderMoveToPosDirect命令的不同之处在于,当目标方向与当前方向的夹角在某个阀值之内时,将在转弯的同时向前移动。
 /// </summary>
 /// <param name="aimPos">目标点</param>
 /// <param name="smoothAng">允许在转弯的同时向前移动的最大角度</param>
 /// <param name="vel">向前移动的速度。如果为0,将取最大速度</param>
 /// <param name="rotaVel">旋转的速度。如果为0,将取最大速度</param>
 /// <param name="finishHandler">命令结束后的处理函数</param>
 /// <param name="stopCallFinish">指定当命令被终止时是否调用结束处理函数</param>
 public OrderMoveToPosSmooth ( Vector2 aimPos, float smoothAng, float vel, float rotaVel, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.aimPos = aimPos;
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
     this.vel = Math.Abs( vel );
     this.rotaVel = Math.Abs( rotaVel );
     this.smoothAng = smoothAng;
 }
Ejemplo n.º 8
0
 public OrderMoveToPosDirect ( Vector2 aimPos, float rotaVel, float forwardVel, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.aimPos = aimPos;
     this.rotaVel = rotaVel;
     this.forwardVel = forwardVel;
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
 }
Ejemplo n.º 9
0
 public abstract void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler);
Ejemplo n.º 10
0
 public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
 {
     stage.SwitchLocation(user, targetList[0]);
     handler(null);
     base.Execute(stage, user, targetList, handler);
 }
Ejemplo n.º 11
0
            public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
            {
                PresentationGroup p = new PresentationGroup(2, stage, user, targetList, handler);

                p[0].AddEffect(new SlashEffect(targetList[0].x, targetList[0].y, 0));
                p[0].SetUserAnimation(SpriteAnimation.GetSpriteAnimation("MeleeAttackDown"));

                p[1].AddEffect(targetList[0].DealDamage(user.fighter.strength));
                p[1].SetTargetAnimation(SpriteAnimation.GetSpriteAnimation("Shake"));

                p.Start();

                base.Execute(stage, user, targetList, handler);
            }
Ejemplo n.º 12
0
 /// <summary>
 /// 允许指定结束后调用处理函数的构造函数。
 /// </summary>
 /// <param name="length">距离。大于0表示前进,小于0表示后退</param>
 /// <param name="speed">移动速度。无论前进或后退都输入正数。输入零表示最大速度</param>
 /// <param name="finishHandler">命令结束后的处理函数</param>
 /// <param name="stopCallFinish">指定当命令被终止时是否调用结束处理函数</param>
 public OrderMove ( float length, float speed, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.length = length;
     this.speed = Math.Abs( speed );
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
 }
Ejemplo n.º 13
0
 public virtual void Tick(ActionFinishHandler handler)
 {
 }
Ejemplo n.º 14
0
 public virtual void Ready(ActionFinishHandler handler)
 {
 }
Ejemplo n.º 15
0
 public virtual void Hit(ActionFinishHandler handler)
 {
 }
Ejemplo n.º 16
0
 public virtual void Finish(ActionFinishHandler handler)
 {
     Finished = true;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 允许指定结束后调用处理函数的构造函数。
 /// </summary>
 /// <param name="aimAzi">目标方位角</param>
 /// <param name="angSpeed">转向速度。如果是0,则使用最大旋转角速度</param>
 /// <param name="finishHandler">命令结束后的处理函数</param>
 /// <param name="stopCallFinish">指定当命令被终止时是否调用结束处理函数</param>
 public OrderRotaRaderToAzi ( float aimAzi, float angSpeed, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.aimAzi = aimAzi;
     this.angSpeed = Math.Abs( angSpeed );
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
 }
Ejemplo n.º 18
0
 public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 允许指定结束后调用处理函数的构造函数。
 /// </summary>
 /// <param name="aimAzi">目标位置</param>
 /// <param name="angSpeed">转向速度。如果是0,则使用最大旋转角速度</param>
 /// <param name="finishHandler">命令结束后的处理函数</param>
 /// <param name="stopCallFinish">指定当命令被终止时是否调用结束处理函数</param>
 public OrderRotaRaderToPos ( Vector2 aimPos, float angSpeed, ActionFinishHandler finishHandler, bool stopCallFinish )
 {
     this.aimPos = aimPos;
     this.angSpeed = Math.Abs( angSpeed );
     this.finishHandler = finishHandler;
     this.stopCallFinish = stopCallFinish;
 }
Ejemplo n.º 20
0
 public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
 {
     ((HeroObject)user).DecreaseSP(manaUsage);
 }
Ejemplo n.º 21
0
 public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
 {
     foreach (FighterObject target in targetList)
     {
         target.RestoreHP(((Hero)user.fighter).intelligence * 2);
     }
     handler(null);
     base.Execute(stage, user, targetList, handler);
 }
Ejemplo n.º 22
0
        public override void Execute(BattleStage stage, FighterObject user, List <FighterObject> targetList, ActionFinishHandler handler)
        {
            PresentationGroup p = new PresentationGroup(3, stage, user, targetList, handler);

            p[0].AddEffect(new SlashEffect(targetList[0].x, targetList[0].y, 0));
            p[0].SetUserAnimation(SpriteAnimation.GetSpriteAnimation("MeleeAttackUp"));

            p[1].SetTargetAnimation(SpriteAnimation.GetSpriteAnimation("Shake"));
            p[1].AddEffect(targetList[0].DealDamage(((Hero)user.fighter).strength));

            p[2].SetExtraMethod(() => targetList[0].AddBuff(new Frozen(), Global.Properties.FRAME_PER_SECOND * 3));

            p.Start();

            base.Execute(stage, user, targetList, handler);
        }