fix stats
This commit is contained in:
@@ -58,8 +58,6 @@ public class Player : MonoBehaviour
|
|||||||
_navAgent.updatePosition = false;
|
_navAgent.updatePosition = false;
|
||||||
|
|
||||||
_currentActing = PlayerStates.Awake;
|
_currentActing = PlayerStates.Awake;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
@@ -177,12 +175,6 @@ public class Player : MonoBehaviour
|
|||||||
return Mathf.Abs(Quaternion.Dot(q1, q2)) >= 1 - precision;
|
return Mathf.Abs(Quaternion.Dot(q1, q2)) >= 1 - precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private TaskStatus InteractWithObject(BaseInteractableObject interactableObject)
|
|
||||||
//{
|
|
||||||
// interactableObject.Interact(this);
|
|
||||||
// return TaskStatus.Complete;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void SetPlayerAnimation(AnimationStates newState, Action onAnimationFinish)
|
public void SetPlayerAnimation(AnimationStates newState, Action onAnimationFinish)
|
||||||
{
|
{
|
||||||
_OnAnimationFinish = onAnimationFinish;
|
_OnAnimationFinish = onAnimationFinish;
|
||||||
@@ -225,9 +217,10 @@ public class Player : MonoBehaviour
|
|||||||
break;
|
break;
|
||||||
case PlayerStates.Sleeping:
|
case PlayerStates.Sleeping:
|
||||||
Stats[StatsId.Energy].increase(0.2f);
|
Stats[StatsId.Energy].increase(0.2f);
|
||||||
|
Stats[StatsId.Food].deduct(0.03f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Stats[StatsId.Food].deduct(0.034f); // 48 hours it's 100, 100/2880=~0.034 per minute
|
Stats[StatsId.Food].deduct(0.05f); // 48 hours it's 100, 100/2880=~0.034 per minute
|
||||||
Stats[StatsId.Energy].deduct(0.1f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
Stats[StatsId.Energy].deduct(0.1f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
public class Stat
|
public class Stat
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; private set; }
|
||||||
public float Value { get; set; }
|
public float Value { get; private set; }
|
||||||
public float Price { get; set; }
|
public float Price { get; private set; }
|
||||||
public float Quantity { get; set; }
|
public float Quantity { get; private set; }
|
||||||
public float MaxValue { get; set; }
|
public float MaxValue { get; private set; }
|
||||||
|
|
||||||
public Stat(string name, float startValue, float maxValue)
|
public Stat(string name, float startValue, float maxValue)
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,10 @@ public class Stat
|
|||||||
|
|
||||||
public void increase(float byAmount)
|
public void increase(float byAmount)
|
||||||
{
|
{
|
||||||
Value += byAmount;
|
if (Value < MaxValue)
|
||||||
|
{
|
||||||
|
Value += byAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool deduct(float amount)
|
public bool deduct(float amount)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class TimeSliderUI : MonoBehaviour
|
|||||||
Hide();
|
Hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SliderValueChanger(_slider.value);
|
||||||
_slider.onValueChanged.AddListener(x=>SliderValueChanger(x));
|
_slider.onValueChanged.AddListener(x=>SliderValueChanger(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user