Beispiel #1
0
        //显示边界警告
        public void DisplayBoundaryWarn(Vector2 pos, BoundaryType type)
        {
            if (type == BoundaryType.Right)
            {
                boundaryWarner.CenterSprite(TRS.Local.MiddleLeft);
                if (boundaryWarner.Rotation != GameBase.Right)
                {
                    boundaryWarner.Rotate(boundaryWarner.Rotation);
                    boundaryWarner.Rotate(GameBase.Right);
                }
                else
                {
                    boundaryWarner.SetPosition(pos);
                }
            }

            if (type == BoundaryType.Left)
            {
                boundaryWarner.CenterSprite(TRS.Local.MiddleLeft);
                if (boundaryWarner.Rotation != GameBase.Left)
                {
                    boundaryWarner.Rotate(boundaryWarner.Rotation);
                    boundaryWarner.Rotate(GameBase.Left);
                }
                else
                {
                    boundaryWarner.SetPosition(pos);
                }
            }

            if (type == BoundaryType.Up)
            {
                boundaryWarner.CenterSprite(TRS.Local.MiddleLeft);
                if (boundaryWarner.Rotation != GameBase.Down)
                {
                    boundaryWarner.Rotate(GameBase.Right);
                    boundaryWarner.Rotate(GameBase.Down);
                }
                else
                {
                    boundaryWarner.SetPosition(pos);
                }
            }

            if (type == BoundaryType.Down)
            {
                boundaryWarner.CenterSprite(TRS.Local.MiddleLeft);
                if (boundaryWarner.Rotation != GameBase.Up)
                {
                    boundaryWarner.Rotate(GameBase.Right);
                    boundaryWarner.Rotate(GameBase.Up);
                }
                else
                {
                    boundaryWarner.SetPosition(pos);
                }
            }
        }
Beispiel #2
0
        public override void UpdateFrame(float dt)
        {
            if (ticker60Fps.isTime(dt))
            {
                body.SetPosition(body.GetPosition() + Dir * Speed);

                nowShootDis += Speed;
                if (nowShootDis > maxShootDis)
                {
                    HP = 0;
                }
            }

            base.UpdateFrame(dt);
        }
Beispiel #3
0
        public override void UpdateFrame(float dt)
        {
            if (ticker60Fps.isTime(dt))
            {
                if (Speed > 0)
                {
                    Speed -= speedDamp;
                    if (Speed < 0)
                    {
                        Speed = 0;
                    }
                }
                //自转
                Body.Rotate(rotation);
                body.SetPosition(body.GetPosition() + Dir * Speed);
            }

            startBomb -= dt;
            if (startBomb < 0)
            {
                startBomb = 0;
                isBomb    = true;
            }
            //
            if (isBomb == true)
            {
                bombKeepTime -= dt;
                //持续时间结束就死亡
                if (bombKeepTime < 0)
                {
                    HP = 0;
                }
            }
            //
            if (NoContactTime > 0)
            {
                NoContactTime -= dt;
            }


            base.UpdateFrame(dt);
        }
Beispiel #4
0
 /// <summary>
 /// 使一些物体不随摄像机移动.
 /// </summary>
 public void KeepPos(Vector2 v2)
 {
     background.SetPosition(background.GetPosition() + v2);
 }
Beispiel #5
0
 public void SetPosition(Vector2 pos)
 {
     body.SetPosition(pos);
 }