added new models

This commit is contained in:
2023-03-03 09:30:17 +02:00
parent f5733d0ffd
commit 5e4be5be1c
57 changed files with 2212 additions and 42 deletions
+7 -28
View File
@@ -7,27 +7,7 @@ using System.Runtime.Serialization;
using UnityEngine;
using UnityEngine.AI;
public class BlockingAnimation : Attribute
{
}
public enum Tasks { Move, Interact, Rotate };
public enum TaskStatus { Waiting, InProgress, Complete };
public enum AnimationStates
{
[EnumMember(Value = "Idle")]
Idle,
[EnumMember(Value = "Move")]
Walking,
[EnumMember(Value = "Sleeping")]
Sleeping,
[EnumMember(Value = "StandToSit")]
[BlockingAnimation]
Sitting,
[EnumMember(Value = "SitToStand")]
[BlockingAnimation]
Standing
};
public class BlockingAnimation : Attribute{}
public class Player : MonoBehaviour
{
@@ -106,7 +86,7 @@ public class Player : MonoBehaviour
_currentTask.UpdateStatus(MoveToPoint());
break;
case Tasks.Interact:
if (pathComplete(_currentTask.TagretObject._playerArrivePoint.position))
if (IsPathComplete(_currentTask.TagretObject._playerArrivePoint.position))
_currentTask.UpdateStatus(InteractWithObject(_currentTask.TagretObject));
else
{
@@ -131,10 +111,10 @@ public class Player : MonoBehaviour
Vector2 velocity = (Time.deltaTime > 1e-5f) ? _groundDeltaPosition / Time.deltaTime : Vector2.zero;
_animator.SetFloat(WALK_VELOCITY, velocity.y);
return pathComplete(_navAgent.destination) ? TaskStatus.Complete : TaskStatus.InProgress;
return IsPathComplete(_navAgent.destination) ? TaskStatus.Complete : TaskStatus.InProgress;
}
private bool pathComplete(Vector3 destination)
private bool IsPathComplete(Vector3 destination)
{
if (Vector3.Distance(destination, _navAgent.transform.position) <= _navAgent.radius)
{
@@ -216,10 +196,9 @@ public class Player : MonoBehaviour
}
}
public void BuyObject(FoodObjectSO objectToBuy)
public void Pay(float amount)
{
Stats[StatsId.Money].deduct(objectToBuy.objectPrice);
//action.ApplyAction(this);
Stats[StatsId.Money].deduct(amount);
}
public float Eat()
@@ -238,6 +217,7 @@ public class Player : MonoBehaviour
?.GetCustomAttribute<EnumMemberAttribute>(false)
?.Value;
}
private static bool IsBlockingAnimation<T>(T value)
where T : struct, IConvertible
{
@@ -247,7 +227,6 @@ public class Player : MonoBehaviour
return attr != null;
}
public void SetFoodObject(FoodObject foodObject)
{
foodObject.transform.parent = _holdPoint;