weather wheel and weather adjustments

This commit is contained in:
Melbyj1125
2022-02-28 13:42:51 -06:00
parent 46dff8f663
commit 5b6b4a2cb9
12 changed files with 194 additions and 229 deletions

View File

@@ -5,6 +5,9 @@ using UnityEngine.Assertions;
public class PlayerStats : MonoBehaviour
{
public enum Weather {Rain, Snow, Wind, Fog};
//Soft cap max speed a player can achieve they can achieve this speed by running
[SerializeField] private float maxVel = 40.0f;
public float MaxVel{
@@ -40,6 +43,12 @@ public class PlayerStats : MonoBehaviour
set{ acc = value; }
}
[SerializeField] private float curAcc;
public float CurAcc{
get{ return curAcc; }
set{ curAcc = value;}
}
//Player Jump power
[SerializeField] private float jumpPow = 60.0f;
public float JumpPow{
@@ -61,6 +70,12 @@ public class PlayerStats : MonoBehaviour
set{ traction = value; }
}
[SerializeField] private float curTraction;
public float CurTraction{
get{ return curTraction; }
set{ curTraction = value; }
}
//Player Kick Power
[SerializeField] private float kickPow = 500.0f;
public float KickPow{
@@ -131,6 +146,87 @@ public class PlayerStats : MonoBehaviour
set{ playerPoints = value; }
}
[SerializeField] private bool windOn = false;
public bool WindOn{
get{ return windOn; }
}
private float tempTraction;
private float tempAcc;
private float accModification;
public void SetWeather(Weather weather){
switch(weather){
case Weather.Rain:{
Debug.Log("Rain");
tempTraction = traction;
tempAcc = acc;
traction -= 2;
if(curTraction - 2 > 0){
curTraction -= 2;
}
acc += 2;
curAcc += 2;
accModification = 2;
break;
}
case Weather.Snow:{
Debug.Log("Snow");
tempTraction = traction;
tempAcc = acc;
traction += 2;
if(curTraction > .01 && curTraction != 1){
curTraction += 2;
}
acc *= .5;
curAcc *= .5;
accModification = -acc;
break;
}
case Weather.Wind:{
Debug.Log("Wind");
windOn = true;
break;
}
case Weather.Fog:{
Debug.Log("Fog");
break;
}
default:{
Debug.Log("Incorrect thing passed in");
break;
}
}
}
public void ClearWeather(){
acc = tempAcc;
traction = tempTraction;
if(curTraction > .01 && curTraction != 1){
curTraction = traction;
}
curAcc -= accModification;
windOn = false;
}
void Update(){
VariableValidation();
}