Пример #1
0
        private void SetupEntities()
        {
            //  Create game with data. This is non-visual.
            _gameEntity = _pool.CreateEntity();
            _gameEntity.AddScore(0);
            _gameEntity.AddAudioSettings(false);

            //  Create human player on the right
            Entity playerEntity = _pool.CreateEntity();

            playerEntity.AddResource("Prefabs/Player");
            playerEntity.AddVelocity(RMC.Common.UnityEngineReplacement.Vector3.zero);
            playerEntity.AddFriction(RMC.Common.UnityEngineReplacement.Vector3.zero);
            playerEntity.AddPosition(RMC.Common.UnityEngineReplacement.Vector3.zero);
            playerEntity.WillAcceptInput(true);
            playerEntity.AddTick(Time.deltaTime);
        }
Пример #2
0
        private void SetupEntities()
        {
            //Debug.Log("GameController.SetupEntities()");
            //Debug.Log(bounds.min.y + " and " + bounds.max.y);


            //  Create game with data. This is non-visual.
            _gameEntity = _pool.CreateEntity();
            _gameEntity.IsGame(true);
            _gameEntity.AddBounds(_screenBounds);
            _gameEntity.AddScore(0, 0);
            _gameEntity.AddTime(0, 0, false);
            _gameEntity.AddAudioSettings(false);
            _gameEntity.AddTick(0);

            //  Create human player on the right
            Entity whitePaddleEntity = _pool.CreateEntity();

            whitePaddleEntity.AddPaddle(PaddleComponent.PaddleType.White);
            whitePaddleEntity.AddResource("Prefabs/PaddleWhite");
            whitePaddleEntity.AddVelocity(RMC.Common.UnityEngineReplacement.Vector3.zero);
            whitePaddleEntity.AddFriction(RMC.Common.UnityEngineReplacement.Vector3.zero);
            whitePaddleEntity.WillAcceptInput(true);
            whitePaddleEntity.AddTick(0);
            whitePaddleEntity.OnComponentAdded += OnWhitePaddleComponentAdded;

            //  Create computer player on the left
            Entity blackPaddleEntity = _pool.CreateEntity();

            blackPaddleEntity.AddPaddle(PaddleComponent.PaddleType.Black);
            blackPaddleEntity.AddResource("Prefabs/PaddleBlack");
            blackPaddleEntity.AddVelocity(RMC.Common.UnityEngineReplacement.Vector3.zero);
            blackPaddleEntity.AddFriction(RMC.Common.UnityEngineReplacement.Vector3.zero);
            blackPaddleEntity.AddAI(whitePaddleEntity, 1, 25f);
            blackPaddleEntity.AddTick(0);
            blackPaddleEntity.OnComponentAdded += OnBlackPaddleComponentAdded;
        }