示例#1
0
        public void Construct(PlayerStateFactory stateFactory, SignalBus signalBus)
        {
            Debug.Log("Player Contruct");

            _stateFactory = stateFactory;
            _signalBus    = signalBus;
        }
示例#2
0
 public void Construct(PlayerStateFactory stateFactory, Settings settings, SignalBus signalBus, MenuSettings menuSettings)
 {
     _stateFactory = stateFactory;
     _settings     = settings;
     _signalBus    = signalBus;
     _menuSettings = menuSettings;
 }
示例#3
0
 private void Construct(Rope rope,
                        FollowCamera2D followCamera2D,
                        PlayerStateFactory stateFactory,
                        UiManager uiManager)
 {
     _rope         = rope;
     _followCamera = followCamera2D;
     _stateFactory = stateFactory;
     _uiManager    = uiManager;
 }
示例#4
0
    //public bool IsFalling { get { return _isFalling;  } }
    #endregion

    void Awake()
    {
        _playerControls = new PlayerControls();
        _rb             = GetComponent <Rigidbody2D>();
        _anim           = GetComponent <Animator>();
        ledgeInfo       = GetComponent <LedgeInformation>();
        audioManager    = FindObjectOfType <AudioManager>();
        ragdoll         = FindObjectOfType <RagdollController>();
        interact        = GetComponent <Interact>();

        //camera test
        camManager = FindObjectOfType <CameraManager>();

        //Controls calling OnMovement Input Function
        _playerControls.Gameplay.Move.started   += OnMovementInput;
        _playerControls.Gameplay.Move.canceled  += OnMovementInput;
        _playerControls.Gameplay.Move.performed += OnMovementInput;
        //_playerControls.Gameplay.Jump.started += OnJump; //Default
        //_playerControls.Gameplay.Jump.canceled += OnJump; //Default
        _playerControls.Gameplay.Jump.started  += ctx => OnJump();
        _playerControls.Gameplay.Jump.canceled += ctx => OnJumpReleased();

        _playerControls.Gameplay.Jetpack.performed += ctx => Thrust();
        _playerControls.Gameplay.Jetpack.canceled  += ctx => ThrustReleased();

        //Converting strings to hash is more performant
        _isGroundedHash = Animator.StringToHash("isGrounded");
        _isRunningHash  = Animator.StringToHash("isRunning");
        _isFallingHash  = Animator.StringToHash("isFalling");
        _jumpHash       = Animator.StringToHash("Jump");
        //speedXHash = Animator.StringToHash("SpeedX");

        // setup state
        _states = new PlayerStateFactory(this); // passes this PlayerStateMachine instance. PlayerStateFactory is expecting a PlayerStateMachine

        _currentState = _states.Idle();
        _currentState.EnterState();
    }
示例#5
0
    public void Construct(PlayerStateFactory stateFactory)
    {
        _stateFactory = stateFactory;

        currentDirection = Direction.UP;
    }
示例#6
0
 public PlayerHealingState(PlayerStateMachine currentContext, PlayerStateFactory playerstateFactory) : base(currentContext, playerstateFactory)
 {
 }
示例#7
0
 public void Construct(PlayerStateFactory stateFactory, Settings settings)
 {
     _stateFactory = stateFactory;
     _settings     = settings;
 }
示例#8
0
 public PlayerBaseState(PlayerStateMachine currentContext, PlayerStateFactory playerStateFactory)
 {
     context = currentContext;
     factory = playerStateFactory;
 }
 public PlayerGroundedState(PlayerStateMachine currentContext, PlayerStateFactory playerstateFactory) : base(currentContext, playerstateFactory)
 {
 }
    public void PlayerFactoryResolved()
    {
        PlayerStateFactory stateFactory = Container.Resolve <PlayerStateFactory>();

        Assert.NotNull(stateFactory);
    }
示例#11
0
 public PlayerInteractingState(PlayerStateMachine currentContext, PlayerStateFactory playerstateFactory, IInteractable interactable) : base(currentContext, playerstateFactory)
 {
     context.InteractingWith = interactable;
     isRootState             = true;
 }
示例#12
0
 public PlayerAliveState(PlayerStateMachine currentContext, PlayerStateFactory playerstateFactory) : base(currentContext, playerstateFactory)
 {
     isRootState = true;
 }
示例#13
0
 public PlayerContext(BasicInput input, Thruster thruster, Cannon cannon, Transform transform, Rigidbody rigidbody)
 {
     _factory = new PlayerStateFactory(this, input, thruster, cannon, transform, rigidbody);
 }
示例#14
0
 //constructor functions
 // passes cocnrete state arguments directly to the base state constructor
 public PlayerGrabbingBoxState(PlayerStateMachine currentContext, PlayerStateFactory playerStateFactory)
     : base(currentContext, playerStateFactory)
 {
 }
 public PlayerInfiniteSworGlitchState(PlayerStateMachine currentContext, PlayerStateFactory playerstateFactory) : base(currentContext, playerstateFactory)
 {
     isRootState = true;
 }
示例#16
0
 public PlayerJetpackState(PlayerStateMachine currentContext, PlayerStateFactory playerStateFactory)
     : base(currentContext, playerStateFactory)
 {
 }
示例#17
0
 public PlayerLedgeHangState(PlayerStateMachine currentContext, PlayerStateFactory playerStateFactory)
     : base(currentContext, playerStateFactory)
 {
 }
示例#18
0
 public PlayerInCinematicState(PlayerStateMachine currentContext, PlayerStateFactory playerStateFactory)
     : base(currentContext, playerStateFactory)
 {
 }