예제 #1
0
        public Item(Vector2 position, string itemState)
        {
            lookupTable = new Dictionary <string, IItemState>();
            PopulateLookup();

            Position     = position;
            Velocity     = Vector2.Zero;
            MaxVelocity  = new Vector2(GameValues.ItemInitialMaxXVelocity, GameValues.PhysicsMaxYVelocity);
            Acceleration = Vector2.Zero;
            itemStateTransitionMachine = new ItemStateTransitionMachine();
            Spawning              = false;
            FinishedSpawning      = false;
            FinishedYoshiSpawning = false;

            if (lookupTable.ContainsKey(itemState))
            {
                ItemState = lookupTable[itemState];
            }
            else
            {
                ItemState = new NoItem();
            }

            ItemState.Initialize();
            PreviousItemState = ItemState;

            CollisionRectangle = GameValues.EmptyCollisionRectangle;
            Velocity           = new Vector2(MaxVelocity.X, 0);
        }