public virtual void NormalJump(Vector2 direction) { if (_dynamicInteraction.Interacting) { _dynamicInteraction.StopInteraction(true); } if (GetJumps() <= 0) { _timeManager.SetNormalTime(); } _cameraBehaviour.DoShake(.3f, .1f); _stickiness.Detach(); direction = direction.normalized; LoseJump(); _dynamicEntity.Rigidbody.velocity = Vector2.zero; _dynamicEntity.Rigidbody.AddForce(direction * _strength, ForceMode2D.Impulse); _poolManager.GetPoolable <Dash>(Transform.position, Quaternion.LookRotation(Vector3.forward, direction)); if (TrajectoryInUse()) { CommitJump(); } Trajectory = null; }
public override void Die(Transform killer = null, Audio sound = null, float volume = 1f) { if (Dead) { return; } Dead = true; Stickiness.Detach(); Jumper?.CancelJump(); if (killer != null) { Stickiness.Rigidbody.AddForce((Transform.position - killer.position).normalized * 10000); } if (sound != null) { _audioManager.PlaySound(_audioSource, sound, volume); } SetAllBehavioursActivation(false, false); StopDisplayGhosts(); Renderer.color = ColorUtils.Red; _timeManager.StartSlowDownProgressive(.3f); if (DynamicInteraction.Interacting) { DynamicInteraction.StopInteraction(false); } StartCoroutine(Dying()); }