コード例 #1
0
ファイル: Player.cs プロジェクト: thk123/Perspective
        public Player(Position pos)
        {
            this.pos = pos;
            oldState = Keyboard.GetState();

            reset();
        }
コード例 #2
0
ファイル: EnemyManager.cs プロジェクト: thk123/Perspective
 public void addEnemy(EnemyType type, Position pos, int lifetime = 10 * 1000, int maxDimensionOfMovement = int.MaxValue)
 {
     Enemy n;
     switch (type)
     {
         case EnemyType.ZigZag0:
             {
                 n = new ZigZag(type, pos, 0, lifetime, maxDimensionOfMovement);
                 break;
             }
         case EnemyType.ZigZag1:
             {
                 n = new ZigZag(type, pos, 1, lifetime, maxDimensionOfMovement);
                 break;
             }
         case EnemyType.StraightLine:
             {
                 n = new StraightLineEnemy(type, pos, lifetime, maxDimensionOfMovement);
                 break;
             }
         default:
             {
                 throw new NotImplementedException();
             }
     }
     enemies.Add(n);
 }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: thk123/Perspective
 protected Enemy(EnemyType type, Position pos, long lifeTime, int maxDimensionOfMovement, int damageAmount = 20)
 {
     this.pos = pos;
     this.type = type;
     this.maxDimensionOfMovement = maxDimensionOfMovement;
     deathTime = System.DateTime.Now.AddMilliseconds(lifeTime);
     this.damageAmount = damageAmount;
 }
コード例 #4
0
ファイル: RenderPlane.cs プロジェクト: thk123/Perspective
        //Color bg;
        public RenderPlane(Rectangle screenPosition, int xDimension, int yDimension, DimensionalManager dimensionalManager)
        {
            this.xDimension = xDimension;
            this.yDimension = yDimension;

            planePosition = new Position(yDimension);
            this.dimensionalManager = dimensionalManager;

            render2d = false;
            renderTarget = screenPosition;

            //this.bg = backgroundColour;
        }
コード例 #5
0
 public StraightLineEnemy(EnemyType type, Position pos, long lifeTime, int maxDimensionOfMovement)
     : base(type, pos, lifeTime, maxDimensionOfMovement)
 {
     speed = new List<float>();
 }
コード例 #6
0
ファイル: RenderPlane.cs プロジェクト: thk123/Perspective
 public void UpdatePosition(Position newPosition)
 {
     planePosition = newPosition;
 }
コード例 #7
0
ファイル: RenderPlane.cs プロジェクト: thk123/Perspective
 private Vector2 getPlanarPosition(Position enemyPosition)
 {
     Vector2 planarPosition;
     if (render2d)
     {
         planarPosition = new Vector2(enemyPosition.GetPosition(xDimension), enemyPosition.GetPosition(yDimension));
     }
     else
     {
         planarPosition = new Vector2(enemyPosition.GetPosition(xDimension), 0);
     }
     return planarPosition;
 }
コード例 #8
0
ファイル: Game1.cs プロジェクト: thk123/Perspective
        private void drawLocation(SpriteBatch spriteBatch, Position position)
        {
            int getPlayerDimension = player.getCurrentDimension();
            Vector2 stringPosition = Vector2.Zero;
            spriteBatch.DrawString(defaultFont14, "{", stringPosition, Color.White);
            stringPosition.X += defaultFont14.MeasureString("{").X;

            string startingPoint = position.GetPosition(0).ToString();
            spriteBatch.DrawString(defaultFont14, startingPoint, stringPosition, getIndexColour(0, getPlayerDimension));
            stringPosition.X += defaultFont14.MeasureString(startingPoint).X;

            for (int i = 1; i < dimensionalManager.GetNumberOfActiveDimensions(); ++i)
            {
                string point = ", " + position.GetPosition(i).ToString();
                spriteBatch.DrawString(defaultFont14, point, stringPosition, getIndexColour(i, getPlayerDimension));
                stringPosition.X += defaultFont14.MeasureString(point).X;
            }

            spriteBatch.DrawString(defaultFont14, "}", stringPosition, Color.White);
        }
コード例 #9
0
ファイル: ZigZag.cs プロジェクト: thk123/Perspective
 public ZigZag(EnemyType type, Position pos, int dimToMoveIn, long lifeTime, int maxDimensionOfMovement)
     : base(type, pos, lifeTime, maxDimensionOfMovement)
 {
     this.dimToMoveIn = dimToMoveIn;
 }