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 void RotateShip()
 {
     body.Rotate(RotSpeed);
 }