CleanupCode add eating
This commit is contained in:
@@ -157,7 +157,7 @@ public class Player : MonoBehaviour
|
||||
return TaskStatus.InProgress;
|
||||
}
|
||||
|
||||
public static bool IsApproximate(Quaternion q1, Quaternion q2, float precision)
|
||||
private bool IsApproximate(Quaternion q1, Quaternion q2, float precision)
|
||||
{
|
||||
return Mathf.Abs(Quaternion.Dot(q1, q2)) >= 1 - precision;
|
||||
}
|
||||
@@ -189,7 +189,6 @@ public class Player : MonoBehaviour
|
||||
string stateName = PlayerHelper.GetEnumMemberValue(_currentAnimation);
|
||||
var stateInfo = _animator.GetCurrentAnimatorStateInfo(animLayer);
|
||||
return stateInfo.IsName(stateName) && stateInfo.normalizedTime < 1.0f;
|
||||
|
||||
}
|
||||
|
||||
public void AddTask(PlayerTasks task)
|
||||
@@ -204,14 +203,18 @@ public class Player : MonoBehaviour
|
||||
|
||||
public void UpdateStatsByClock()
|
||||
{
|
||||
Stats[StatsId.Food].deduct(0.034f); // 48 hours it's 100, 100/2880=~0.034 per minute
|
||||
if (_currentActing != PlayerStates.Sleeping)
|
||||
switch (_currentActing)
|
||||
{
|
||||
Stats[StatsId.Energy].deduct(0.1f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
||||
}
|
||||
else
|
||||
{
|
||||
Stats[StatsId.Energy].increase(0.2f);
|
||||
case PlayerStates.Eating:
|
||||
Stats[StatsId.Food].increase(10f);
|
||||
break;
|
||||
case PlayerStates.Sleeping:
|
||||
Stats[StatsId.Energy].increase(0.2f);
|
||||
break;
|
||||
default:
|
||||
Stats[StatsId.Food].deduct(0.034f); // 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
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,13 +222,13 @@ public class Player : MonoBehaviour
|
||||
{
|
||||
Stats[StatsId.Money].deduct(amount);
|
||||
}
|
||||
|
||||
public void SetContainerItem(ContainerItem containerItem)
|
||||
{
|
||||
containerItem.transform.parent = _holdPoint;
|
||||
containerItem.transform.localPosition = Vector3.zero;
|
||||
_containerItem = containerItem;
|
||||
}
|
||||
|
||||
public ContainerItem GetContainerItem()
|
||||
{
|
||||
return _containerItem;
|
||||
@@ -235,7 +238,6 @@ public class Player : MonoBehaviour
|
||||
Destroy(_containerItem.gameObject);
|
||||
_containerItem = null;
|
||||
}
|
||||
|
||||
public bool IsHoldContainerItem()
|
||||
{
|
||||
return _containerItem != null;
|
||||
|
||||
Reference in New Issue
Block a user