Skip to content

Commit

Permalink
Mankind knew that they could not change society, so instead of reflec…
Browse files Browse the repository at this point in the history
…ting upon themselves, they finally added crown push/pull multiplier, it was a pain in the ass bcs OG script took its own power, without considering it could be different between players :) But they found beauty in the lives of beasts, and couldn’t lie to themselves about it. Pain. Bleach for my eyes and Jesus for my soul :)
  • Loading branch information
SebPautot committed Feb 1, 2022
1 parent cb57ad6 commit 5493691
Show file tree
Hide file tree
Showing 5 changed files with 522 additions and 20 deletions.
26 changes: 14 additions & 12 deletions Assets/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Player : MonoBehaviour
/// L'État du joueur. Voir <see cref="PlayerState"/>.
/// </summary>
public PlayerState State { get => state; set => SetPlayerState(value); }
private float ejectionStrength;

// MISES A JOUR

Expand Down Expand Up @@ -111,7 +112,7 @@ private void UpdateBoost()
return;
}

Vector2 targetVelocity = helpDirection * currentHelpStrength * help.Strength;
Vector2 targetVelocity = helpDirection * currentHelpStrength * ejectionStrength;
currentHelpStrength -= help.Loss;

body.velocity = targetVelocity;
Expand Down Expand Up @@ -205,30 +206,31 @@ public void InputFastFall(InputAction.CallbackContext context)

// ACTIONS

public void PullMe(Player otherPlayer)
public void PullMe(Player otherPlayer, float strength)
{
helpDirection = (otherPlayer.transform.position - transform.position).normalized;
ActivateBoost();
ActivateBoost(strength);
}

public void PushMe(Player otherPlayer)
public void PushMe(Player otherPlayer, float strength)
{
helpDirection = (transform.position - otherPlayer.transform.position).normalized;
ActivateBoost();
ActivateBoost(strength);
}

/// <summary>
/// Lance le joueur vers le haut.
/// </summary>
public void PullUp()
{
helpDirection = Vector3.up;
ActivateBoost();
}
// public void PullUp()
// {
// helpDirection = Vector3.up;
// ActivateBoost();
// }

private void ActivateBoost()
private void ActivateBoost(float strength)
{
currentHelpStrength = 1f;
ejectionStrength = strength;
currentHelpStrength = 1;
State = PlayerState.Boost;
help.SetAvailable();
sound.HelpedSound();
Expand Down
1 change: 1 addition & 0 deletions Assets/Player/Player.prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Assets/Player/PlayerHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class PlayerHelp : MonoBehaviour
public bool CanHelp => helpAvailable && helpTime >= helpCooldown;
public float HelpMod { get; set; } = 1f;
[SerializeField] private float crownHelpRadiusMultiplier = 1f;
[SerializeField] private float crownHelpStrengthMultiplier = 1f;
private void Awake()
{
player = GetComponent<Player>();
Expand Down Expand Up @@ -56,9 +57,9 @@ public void UpdateHelp(PlayerManager manager)
//otherPlayer.PullUp();
//otherPlayer.HelpMe(this);
if (HelpMod >= 1f)
otherPlayer.PushMe(player);
otherPlayer.PushMe(player, (bcc.isCrowned)?Strength * crownHelpStrengthMultiplier:Strength);
else
otherPlayer.PullMe(player);
otherPlayer.PullMe(player, (bcc.isCrowned)?Strength * crownHelpStrengthMultiplier:Strength);

player.State = PlayerState.Moving;
helpTime = 0f;
Expand Down
Loading

0 comments on commit 5493691

Please sign in to comment.