当前位置: 首页>>代码示例>>C#>>正文


C# Player.Initialize方法代码示例

本文整理汇总了C#中Player.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Initialize方法的具体用法?C# Player.Initialize怎么用?C# Player.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.Initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAndAddPlayer

 private void CreateAndAddPlayer()
 {
     var playerInstance = new Player(DefaultBattlefieldSize);
     playerInstance.Initialize();
     Players.Add(playerInstance);
     Player = playerInstance;
 }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:7,代码来源:GameContext.cs

示例2: Start

    void Start()
    {
        for (int i = 0; i < (int)GameData.ColorNames.NumColors; i++) {
            GameData.SetColorData( (GameData.ColorNames)i, m_pColors[i]);
        }

        EndGameLabel.gameObject.SetActiveRecursively(false);

        ScaleToWin *= GameData.WinSize;
        m_nCurrentGameMode = GameData.nextGameMode;

        m_pEnemyManager = GetComponentInChildren<EnemyManager>();
        m_pEnemyManager.Initialize(this);

        m_pPlayer = GetComponentInChildren<Player>();
        m_pPlayer.Initialize(this);

        switch (m_nCurrentGameMode)
        {
            case GameData.GameMode.Normal:
                break;
            case GameData.GameMode.Endless:
                ScaleToWin = 100;
                ScaleToLose = -100;
                break;
            case GameData.GameMode.Progression:
                break;
            case GameData.GameMode.Reverse:
                break;
            default:
                break;
        }
    }
开发者ID:Epervier,项目名称:SIne,代码行数:33,代码来源:Game.cs

示例3: CarSizeTest

        public void CarSizeTest()
        {
            Player player = new Player();
            player.Initialize();
            const int carSize = 5;
            Transport car = new Transport(TransportType.Car, String.Empty, 100, null, null, 10000);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car));
            Asset wife = new Partner();
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(wife));
            Asset[] carTravellers = {
                                       new Child(),
                                       new Pet()
                                   };

            // Start from 1 as we already added wife asset
            for (var i = 1; i < player.CarSize; i++) {
                Assert.AreEqual(AssetResponse.AddedSuccessfully,
                                player.Accept(carTravellers[RandomHelper.Next(0, carTravellers.Length)]));
            }

            Assert.AreEqual(player.CarSize, player.Assets[AssetType.Transportable].Count);

            for (var i = 0; i < player.CarSize; i++) {
                Assert.AreEqual(AssetResponse.CarFull,
                                player.Accept(carTravellers[RandomHelper.Next(0, carTravellers.Length)]));
            }
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:27,代码来源:PlayerTest.cs

示例4: StoryCardLogicTest

        public void StoryCardLogicTest()
        {
            StoryCardData target = new StoryCardData();
            var stories = StoryCardData.PopulateStoryCards();
            StateFactory.SetInstance(new StateFactory());
            StateFactory.AddFactory(GameStates.Wait, new WaitFactory());

            var gameTime = new GameTime();
            var player = new Player();
            player.Initialize();
            player.Accept(new Transport(TransportType.Car, String.Empty, int.MaxValue, null, null, 0));
            var world = new List<WorldObject> { new StartingNode(Vector2.Zero), new Spinner(Vector2.Zero) };
            var gameInfo = new GameInfo(world, new[] { player }, 100, GameRuleType.Retirement);
            gameInfo.GetNextPlayer();

            foreach (var story in stories) {
                var performingLogic = story.PureLogic;

                Assert.IsNotNull(performingLogic);
                try {
                    var returnedStates = story.PureLogic.PerformLogic(gameTime, gameInfo);
                } catch (Exception e) {
                    Console.WriteLine(e);
                }

            }
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:27,代码来源:StoryCardDataTest.cs

示例5: ActionScene

 public ActionScene(Game game, Texture2D theTexture, Texture2D backgroundTexture, SpriteFont font,Rectangle screenBounds, params IController[] controllers)
     : this(game,theTexture,backgroundTexture,font)
 {
     TwoPlayers = false;
     _player1 = new Player(Game, ref _actionTexture,  new Vector2(screenBounds.Width / 3, 0), new Rectangle(323, 15, 30, 30),controllers);
     _player1.Initialize();
     Components.Add(_player1);
 }
开发者ID:Meshed,项目名称:RockRainEnhanced,代码行数:8,代码来源:ActionScene.cs

示例6: CanInitializePlayer

        public void CanInitializePlayer()
        {
            var player = new Player(10);
            Assert.IsTrue(player.Id == Guid.Empty);

            player.Initialize();
            Assert.IsTrue(player.Id != Guid.Empty);
        }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:8,代码来源:PlayerTest.cs

示例7: AddPlayer

        public void AddPlayer(Player player)
        {
            Players.Add(player);

            if (AvailablesIndexes.Count != 0)
                player.Index = AvailablesIndexes.Pop();
            else
                player.Index = PlayerIndex.Four;

            player.Initialize();
        }
开发者ID:jodigiordano,项目名称:commander,代码行数:11,代码来源:PlayersController.cs

示例8: Initialize

    public void Initialize()
    {
        //renderer.material.color = color;
        _idx = 0;
        //Player prefab = bricReality?ScreenManager.instance.playerRealityPrefab:ScreenManager.instance.playerFantasyPrefab;
        Player prefab = ((int)realityLevel>=(int)RealityLevel.Player)?ScreenManager.instance.playerRealityPrefab:ScreenManager.instance.playerFantasyPrefab;
        _player = GameObject.Instantiate(prefab) as Player;
        _player.Initialize(this);

        GameObject prefab2 = ((int)realityLevel>=(int)RealityLevel.Princess)?ScreenManager.instance.princessRealityPrefab:ScreenManager.instance.princessFantasyPrefab;
        //GameObject prefab2 = bricReality?ScreenManager.instance.princessRealityPrefab:ScreenManager.instance.princessFantasyPrefab;
        _princess = GameObject.Instantiate(prefab2) as GameObject;
        _princess.transform.localScale = new Vector3(
            _princess.transform.localScale.x/(float)level,
            _princess.transform.localScale.y/(float)level,
            _princess.transform.localScale.z
            );
        _princess.transform.position = new Vector3(
            transform.position.x,
            transform.position.y + Camera.main.orthographicSize - _princess.transform.localScale.y*3,
            _princess.transform.position.z
            );

        _nextBlocPosition = new Vector3(
            transform.position.x,
            transform.position.y - transform.localScale.y/2f,
            0
        );

        //CreateNextBloc();
        float cumulatedWidth = 0;
        while (cumulatedWidth<Camera.main.orthographicSize*2 && Mathf.Approximately(cumulatedWidth,Camera.main.orthographicSize*2)==false) {
            CreateNextBloc();
            cumulatedWidth += _lastBlockBounds.size.y;
        }

        _firstBloc = _blocs[0];

        _destroyBlocPosition = new Vector3(
            transform.position.x,
            transform.position.y - transform.localScale.y/2f,
            0
        );
        _generateBlocPosition = new Vector3(
            transform.position.x,
            transform.position.y + transform.localScale.y/2f,
            0
            );
    }
开发者ID:rxra,项目名称:SchyzoRun,代码行数:49,代码来源:Screen.cs

示例9: CarTest

        public void CarTest()
        {
            Player player = new Player();
            player.Initialize();
            const int carSize = 5;
            const int carValue = 123111;
            Transport car = new Transport(TransportType.Car, String.Empty, 100, null, null, carValue);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car));

            Assert.AreEqual(carValue, player.TotalValue);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car));
            Assert.AreEqual(carValue, player.TotalValue);

            const int secondCarValue = 1000;
            Transport car2 = new Transport(TransportType.Car, String.Empty, 100, null, null, secondCarValue);

            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car2));

            Assert.AreEqual(secondCarValue, player.TotalValue);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(car2));
            Assert.AreEqual(secondCarValue, player.TotalValue);
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:22,代码来源:PlayerTest.cs

示例10: BuildGame

        private static Game BuildGame()
        {
            var game = new Game(10);

            var firstPlayer = new Player(10);
            firstPlayer.Initialize();

            var secondPlayer = new Player(10);
            secondPlayer.Initialize();

            game.FirstPlayer = firstPlayer;
            game.SecondPlayer = secondPlayer;

            game.Start();

            return game;
        }
开发者ID:vcartera81,项目名称:Battle-Sea,代码行数:17,代码来源:GameTest.cs

示例11: CashTest

        public void CashTest()
        {
            const int cash = 12312;
            Vector2 location = Vector2.Zero;

            Player player = new Player();
            player.Initialize();
            player.Cash += cash;
            Transport worthlessCar = new Transport(TransportType.Car, String.Empty, 100, null, null, 0);
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(worthlessCar));

            Asset asset1 = new House(15212, "testing house", String.Empty);
            Asset asset2 = new Partner();

            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset1));
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(asset2));

            int expected = cash;
            int actual;
            player.Cash = expected;
            actual = player.Cash;
            Assert.AreEqual(expected, actual);
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:23,代码来源:PlayerTest.cs

示例12: BuildPlayerList

        private void BuildPlayerList()
        {
            LocalSteamId = MyAPIGateway.Multiplayer.MyId;

            Log.Trace("Start building local player list for local steam id " +
                LocalSteamId, "BuildPlayerList");

            var localIngamePlayers = new List<IMyPlayer>();
            MyAPIGateway.Multiplayer.Players.GetPlayers(localIngamePlayers, (x) =>
                x.SteamUserId == LocalSteamId
            );

            if (localIngamePlayers.Count == 0) {
                Log.Error("Failed to find player for my steamId" + LocalSteamId, "Initialize");
            }

            Log.Trace("Building " + localIngamePlayers.Count + " players.", "BuildPlayerList");

            foreach (IMyPlayer ingamePlayer in localIngamePlayers) {
                Player player = new Player(ingamePlayer);
                LocalPlayers.Add(player);
                player.Initialize();
            }
        }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:24,代码来源:ClientConcealSession.cs

示例13: LoadContent

        public void LoadContent(Stream fileStream)
        {
            CreateTiles(fileStream);

            player = new Player();

            player.Initialize(content.Load<Texture2D>("Graphics\\dough-01"), content.Load<Texture2D>("Graphics\\dough-02"), content.Load<Texture2D>("Graphics\\dough-03"), startPos, screenRect, this);
        }
开发者ID:Minovsky,项目名称:Go-Dough-,代码行数:8,代码来源:Level.cs

示例14: PassportStampTest

        public void PassportStampTest()
        {
            Player player = new Player();
            player.Initialize();

            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(new PassportStamp(IslandType.Beach)));
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(new PassportStamp(IslandType.Beach)));
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(new PassportStamp(IslandType.City)));
            Assert.AreEqual(AssetResponse.AddedSuccessfully, player.Accept(new PassportStamp(IslandType.Jungle)));
            Assert.AreEqual(AssetResponse.CollectedAllPassportStamps, player.Accept(new PassportStamp(IslandType.Snow)));
            Assert.AreEqual(AssetResponse.CollectedAllPassportStamps, player.Accept(new PassportStamp(IslandType.City)));
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:12,代码来源:PlayerTest.cs

示例15: Initialize

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

            base.Initialize();
            player = new Player(this);
            bullet = new Bullet(this);
            weapon = new Weapons(this);
            particle = new Particle(this);
            Enemy_List = new List<Enemy>();
            Particle_list = new List<Particle>();
            enemy = new Enemy(this);
            player.Initialize();
            bullet.Initialize();
            enemy.Initialize();
    }
开发者ID:Ziika,项目名称:Project,代码行数:22,代码来源:Game1.cs


注:本文中的Player.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。