public Glider(Player player) { _rigidbody = player.GetComponent <Rigidbody2D>(); _grounder = player.Grounder; _playerAnimator = player.AnimatorController; _glideFallVelocity = player.PlayerParameters.GlideFallVelocity; }
public NewJumper(Player player) { _player = player; _rigidbody = player.gameObject.GetComponent <Rigidbody2D>(); _playerGrounder = player.Grounder; _jumpVelocity = player.PlayerParameters.JumpVelocity; _gravityFallMultiplayer = player.PlayerParameters.GravityFallMultiplayer; _lowGravityFallMultiplayer = player.PlayerParameters.LowGravityFallMultiplayer; _permitedArialTime = player.PlayerParameters.PermitedArialTime; }
public Jumper(Player player) { _player = player; _rigidbody = player.gameObject.GetComponent <Rigidbody2D>(); _playerGrounder = player.Grounder; _jumpVelocity = player.PlayerParameters.JumpVelocity; _maxButtonHoldTime = player.PlayerParameters.MaxJumpHoldTime; _gravityFallMultiplayer = player.PlayerParameters.GravityFallMultiplayer; _velocityWhenTerminateJump = new Vector2(0f, player.PlayerParameters.VelocityWhenTerminateJump); }
private void OnEnable() { Grounder = new Grounder(this); _mover = new NewMover(this); _jumper = new NewJumper(this); _playerLocker = new PlayerLocker(this); _glider = new Glider(this); _attacker = new BasicAttacker(this); Rigidbody.drag = PlayerParameters.BaseDrag; _canDash = true; Grounder.Tick(); }
private void Awake() { AttackerTimer.SetTimer(_playerParameters.TimeBetweenAttacks); _waitForSecondsDash = new WaitForSeconds(_playerParameters.TimeBetweenDashes); Grounder = new Grounder(this); LifeSystem = new LifeSystem(this); _mover = new NewMover(this); _jumper = new Jumper(this); _playerLocker = new PlayerLocker(this); _glider = new Glider(this); _attacker = new BasicAttacker(this); _wallJumper = new WallJumper(this); Rigidbody = this.GetComponent <Rigidbody2D>(); // _attackerList = new List<IAttacker>(); // _attackerList.Add(new BasicAttacker(this)); // _attackerList.Add(new StrongAttacker(this)); }
private void Update() { AttackerTimer.SubtractTimer(); Grounder.Tick(); if (!(_mover is ForceMover)) { if (!_attacking && CanMove) { _mover.Tick(); if (!(_mover is Dasher)) { _jumper.Tick(); _wallJumper.Tick(); } if (Dasher.CheckDashInput()) { StartDash(); } } } else { _mover.Tick(); } _attacker.Tick(); //_attackerList.ForEach(attacker => attacker.Tick()); CheckJumping(); var isGrounded = Grounder.IsGrounded; AnimatorController.UpdateParameters(isGrounded); JustTouchedGround(isGrounded); }