コード例 #1
0
        /// <summary>
        /// Factory method to create a Player ship
        /// </summary>
        /// <param name="PlayerShipType">The type of Player ship to create</param>
        /// <param name="position">The position of the Player ship in the game world</param>
        /// <returns>The game object id of the Player ship</returns>
        public PlayerShip CreatePlayerShip(PlayerShipType PlayerShipType, Vector2 position)
        {
            PlayerShip PlayerShip;
            uint       id = NextID();

            switch (PlayerShipType)
            {
            case PlayerShipType.Shrike:
                PlayerShip = new ShrikeShip(id, content, position);
                break;

            default:
                throw new NotImplementedException("The Player ship type " + Enum.GetName(typeof(PlayerShipType), PlayerShipType) + " is not supported");
            }

            QueueGameObjectForCreation(PlayerShip);
            return(PlayerShip);
        }
コード例 #2
0
        /// <summary>
        /// Factory method to create a Player ship
        /// </summary>
        /// <param name="PlayerShipType">The type of Player ship to create</param>
        /// <param name="position">The position of the Player ship in the game world</param>
        /// <returns>The game object id of the Player ship</returns>
        public PlayerShip CreatePlayerShip(PlayerShipType PlayerShipType, Vector2 position)
        {
            PlayerShip PlayerShip;
            uint id = NextID();

            switch (PlayerShipType)
            {
                case PlayerShipType.Shrike:
                    PlayerShip = new ShrikeShip(id, content, position);
                    break;

                default:
                    throw new NotImplementedException("The Player ship type " + Enum.GetName(typeof(PlayerShipType), PlayerShipType) + " is not supported");
            }

            PlayerShip.ObjectType = ObjectType.Player;
            QueueGameObjectForCreation(PlayerShip);
            return PlayerShip;
        }