TraceRacer.WorldObject.getLine C# (CSharp) Method

getLine() public method

Gets a specific line from the world.
public getLine ( int lineNum ) : WorldLine
lineNum int
return WorldLine
        public WorldLine getLine(int lineNum)
        {
            // Do bounds check first
            if (lineNum >= lineQueue.Count)
            {
                return new WorldLine(10);
            }
            return lineQueue[lineNum];
        }

Usage Example

コード例 #1
0
ファイル: PlayerObject.cs プロジェクト: alexcoco/trace_racer
        /// <summary>
        /// Constructor initializes everything.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="world"></param>
        public PlayerObject(Game game, SpriteBatch givenSpriteBatch, WorldObject world)
            : base(game)
        {
            World = world;
            mySpriteBatch = givenSpriteBatch;

            IsAlive = false;
            Texture = Game.Content.Load<Texture2D>("bike");

            Speed = new Vector2(Constants.NORMAL_SPEED, 0);
            Score = new TraceRacer.Score(game);
            //Position = new Vector2(Speed.X, -Texture.Height);
            Position = new Vector2(100, -Texture.Height);
            CurrentLine = world.getLine((int)Position.X);
        }