Exemplo n.º 1
0
 private void InitializePlayer(IGroup <GameEntity> @group, GameEntity entity, int index, IComponent component)
 {
     entity.AddHealth(GameConfiguration.INSTANCE.playerInitialHealth);
     entity.AddGameAsset(GameConfiguration.INSTANCE.playerAssetPath);
     entity.AddPosition(Vector3.zero);
     entity.AddGameSpeed(Vector3.zero, GameConfiguration.INSTANCE.playerMaxSpeed);
     entity.AddRotation(0f);
     entity.AddAcceleration(0f);
 }
Exemplo n.º 2
0
 public static void AddMovementComponents(GameEntity e, float acceleration, float deceleration, float friction,
                                          float arriveDistance)
 {
     e.AddAcceleration(acceleration);
     e.AddDeceleration(deceleration);
     e.AddFriction(friction);
     e.AddArriveDistance(arriveDistance);
     e.isMover    = true;
     e.isOnGround = true;
 }
Exemplo n.º 3
0
        private void InitializeAsteroids(IGroup <GameEntity> @group, GameEntity asteroid, int index, IComponent component)
        {
            asteroid.AddGameAsset(GameConfiguration.INSTANCE.asteroidAssetPath);

            var initialSpeed = Random.insideUnitSphere * GameConfiguration.INSTANCE.asteroidSpeedCoeff;

            initialSpeed.z = 0;
            asteroid.AddGameSpeed(initialSpeed, 1f);
            asteroid.AddRotation(0f);
            asteroid.AddAcceleration(0);
        }
Exemplo n.º 4
0
    private void CreateKitten()
    {
        //Create test kitty
        GameEntity kittyEntity = _context.CreateEntity();

        kittyEntity.isKitty        = true;
        kittyEntity.isInteractable = true;
        kittyEntity.AddMovementSpeed(5f);
        kittyEntity.AddJumpForce(15f);
        kittyEntity.AddAcceleration(20f);
        kittyEntity.AddCharacterState(CharacterState.Idle);
        kittyEntity.AddCurrentMovementSpeed(0f);
        kittyEntity.AddCharacterGroundState(CharacterGroundState.Undefined);
        kittyEntity.AddPreviousCharacterGroundState(CharacterGroundState.Undefined);
        kittyEntity.AddDistanceToGround(0f);
        kittyEntity.AddGroundHitNormal(Vector2.zero);
        kittyEntity.AddCharacterDirection(CharacterDirection.None);
        kittyEntity.AddStepSize(0.3f);
    }
Exemplo n.º 5
0
    private void CreatePlayer()
    {
        //Create player entity
        GameEntity playerEntity = _context.CreateEntity();

        playerEntity.isPlayer = true;
        playerEntity.AddMovementSpeed(5f);
        playerEntity.AddJumpForce(15f);
        playerEntity.AddAcceleration(20f);
        playerEntity.AddHealth(666);
        playerEntity.AddCharacterState(CharacterState.Idle);
        playerEntity.AddCurrentMovementSpeed(0f);
        playerEntity.AddCharacterGroundState(CharacterGroundState.Undefined);
        playerEntity.AddPreviousCharacterGroundState(CharacterGroundState.Undefined);
        playerEntity.AddDistanceToGround(0f);
        playerEntity.AddGroundHitNormal(Vector2.zero);
        playerEntity.AddCharacterDirection(CharacterDirection.None);
        playerEntity.AddStepSize(0.5f);
    }