Esempio n. 1
0
        protected override void OnAwake()
        {
            base.OnAwake();

            Rigidbody      = GetComponent <Rigidbody2D>();
            Animator       = GetComponent <Animator>();
            SpriteAnimator = spriteObject.GetComponent <Animator>();
            SoundsPlayer   = GetComponentInChildren <SoundsPlayer>();

            GroundShadowController    = GetComponentInChildren <GroundShadowController>();
            StatueMenuController      = GetComponentInChildren <PlayerStatueMenuController>();
            MaskController            = GetComponentInChildren <PlayerMaskController>();
            SpriteDirectionController = GetComponentInChildren <PlayerSpriteDirectionController>();

            GroundDetector = new GroundDetector(groundDetectors, centralGroundDetector, groundDetectionRayDistance, coyoteTime);
            JumpController = new PlayerJumpController(Rigidbody, jumpForce, jumpTime, maxFallVelocity, GroundDetector);
            HorizontalMovementController = new PlayerHorizontalMovementController(Rigidbody, groundVelocity, airVelocity, inputManager);
            AnimationController          = new PlayerAnimationController(Animator, Rigidbody, GroundDetector);
            HealthController             = new PlayerHealthController(this, InitialHealth);
            HurtController             = new PlayerHurtController(this, timeInvulnerable, SpriteAnimator);
            EssenceOfPunishmentCounter = new EssenceOfPunishmentCounter();
            Interaction     = new PlayerInteraction();
            TriggerDetector = new PlayerTriggerDetector();
            KneelController = new PlayerKneelController();
            DeathController = new PlayerDeathController();

            inputManager.Jump        = JumpController.Jump;
            inputManager.StopJumping = JumpController.StopJumping;

            SaveSystem.UnlockMask(PlayerMaskController.MaskType.ShinyMask);

            AddState(InControlState, new NormalState());
            AddState(KneelState, new KneelState());
        }
Esempio n. 2
0
 public PlayerJumpController(Rigidbody2D rigidbody, float jumpForce, float jumpTime, float maxFallVelocity, GroundDetector groundDetector)
 {
     _rigidbody       = rigidbody;
     _groundDetector  = groundDetector;
     _jumpForce       = jumpForce;
     _jumpTime        = jumpTime;
     _maxFallVelocity = maxFallVelocity;
 }
Esempio n. 3
0
        protected override void OnUpdate()
        {
            base.OnUpdate();

            GroundDetector.Update(Time.deltaTime);
            AnimationController.Update();
            HorizontalMovementController.Update();
        }
 public PlayerAnimationController(Animator animator, Rigidbody2D rigidbody, GroundDetector groundDetector)
 {
     _animator       = animator;
     _rigidbody      = rigidbody;
     _groundDetector = groundDetector;
 }
Esempio n. 5
0
 private void OnDrawGizmos()
 {
     GroundDetector?.OnDrawGizmos();
 }