Пример #1
0
 public CharacterChoice(int playerId, Gameplay.Character initialCharacter, Vector2 position)
 {
     PlayerId         = playerId;
     InitialCharacter = initialCharacter;
     this.position    = position;
     _input           = new PlayerInputComponent(PlayerId);
     _stateComponent  = new CharacterChoiceStateMachineComponent(new CharacterChoiceState(PlayerId, InitialCharacter));
     addComponent(RotationAngle);
     addComponent(_input);
     addComponent(_stateComponent);
     SetRotationAngleFixedAtCurrentChoice();
 }
Пример #2
0
        public Player(PlayerSettings settings)
        {
            name     = $"Player_{settings.Id}";
            Settings = settings;

            // physics
            _stateComponent    = new PlayerStateComponent(settings.Id, settings.Side, settings.Speed, settings.StartingPosition);
            _velocity          = new VelocityComponent(new Vector2(0, 0));
            transform.position = settings.StartingPosition;

            // input
            _input = new PlayerInputComponent(settings.Id);
            addComponent(_events);
            addComponent(_stateComponent);
            addComponent(_velocity);
            addComponent(_input);
            addComponent(_kinematic);
        }