private void OnEnable()
 {
     _body2d         = GetComponent <Rigidbody2D>();
     _controller     = GetComponent <ControllableObject>();
     _collisionState = GetComponent <PlayerCollisionState>();
     _audioSource    = GetComponent <AudioSource>();
 }
    private void OnEnable()
    {
        _controller     = GetComponent <ControllableObject>();
        _collisionState = GetComponent <PlayerCollisionState>();

        _shotgunGO = GetComponentInChildren <Shotgun>();
    }
예제 #3
0
 private void OnEnable()
 {
     _GM = GameManager.Instance.GetComponent <GameManager>();
     _effectPositions = GetComponentsInChildren <Transform>();
     _movementManager = GetComponent <PlayerMovementManager>();
     _collisionState  = GetComponent <PlayerCollisionState>();
 }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="components"></param>
 /// <param name="input"></param>
 public PlayerModel(
     Components components,
     PlayerCollisionState collisionState,
     InputState input)
 {
     _components    = components;
     CollisionState = collisionState;
     Input          = input;
 }
    //private bool _animating = false;

    private void OnEnable()
    {
        _collisionState = GetComponent <PlayerCollisionState>();
        _controller     = GetComponent <ControllableObject>();

        // START THE GAME MANAGER, WINDOW MANAGER, AND THE EVENT SYSTEM
        // They are not used in this script, but they started for the reset of the game.
        GameManager          GM  = GameManager.Instance.GetComponent <GameManager>();
        WindowManager        WM  = WindowManager.Instance.GetComponent <WindowManager>();
        EventSystemSingleton ESS = EventSystemSingleton.Instance.GetComponent <EventSystemSingleton>();
    }
예제 #6
0
 //set what the player is coliding with for the purpouses of jumping and wallclimbing
 void GroundWallCheck()
 {
     if (groundCheck.GetComponent <GroundTrigger>().isTriggerd == true)
     {
         if (collisionStateUpdateCD == 0)
         {
             collisionState = PlayerCollisionState.ground;
             anim.grounded  = true;
             isGrounded     = true;
             coyoteTime     = 0.15f;
             remainingJumps = airJumps;
             dash.canDash   = true;
         }
         else
         {
             collisionStateUpdateCD = Mathf.Max(0, collisionStateUpdateCD - Time.deltaTime);
         }
     }
     else if (wallCheck.GetComponent <GroundTrigger>().isTriggerd == true)
     {
         collisionState = PlayerCollisionState.wall;
         anim.grounded  = false;
         isGrounded     = false;
         remainingJumps = airJumps;
     }
     else
     {
         collisionState = PlayerCollisionState.none;
         if (coyoteTime == 0)
         {
             anim.grounded = false;
             isGrounded    = false;
         }
         else
         {
             coyoteTime = Mathf.Max(0, coyoteTime - Time.deltaTime);
         }
     }
 }
예제 #7
0
 protected virtual void Awake()
 {
     _controller     = GameObject.FindGameObjectWithTag("Player").GetComponent <ControllableObject>();
     _collisionState = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollisionState>();
 }
예제 #8
0
 public bool HasCollisionFlag(PlayerCollisionState flag)
 {
     return((CollisionState & flag) != 0);
 }