PlayerState.cs 1.68 KB
Newer Older
mthiele2's avatar
mthiele2 committed
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.IO;
5
using UnityEngine;
6
using UnityEngine.Serialization;
7
using _Game.Scripts.Player.PlayerAttacks.Water;
8

Sebastian Frey's avatar
Sebastian Frey committed
9
namespace _Game.Scripts.Scriptable_Object
10
{
11
	[CreateAssetMenu(fileName = "New Player State", menuName = "Player State", order = 51)]
Sebastian Frey's avatar
Sebastian Frey committed
12 13
	public class PlayerState : ScriptableObject
	{
14 15
		[SerializeField] private InfusedElement currentInfusedElement;

16 17
		[SerializeField] private MovementState currentMoveState;

18
		[SerializeField] private MovementStates movementStates;
19

20 21
		[SerializeField][Range(0, 5)] private int charges;

mthiele2's avatar
mthiele2 committed
22 23 24 25 26 27 28
		//		[SerializeField] private float currentJumpForce;
		//		[SerializeField] private float currentSmoothing;
		//		[SerializeField] private bool currentAirControl;
		//		[SerializeField] private float currentMoveSpeed;
		//		[SerializeField] private int currentMaxJumpCount;
		//		[SerializeField] private float currentMass;
		//		[SerializeField] private float currentGravity;
29

30
		public void UpdateElement(InfusedElement newElement)
31
		{
32
			currentInfusedElement = newElement;
33
			currentMoveState = movementStates.GetMovementState(newElement);
34 35
		}

Sebastian Frey's avatar
Sebastian Frey committed
36
		public MovementState GetCurrentMovementState()
37
		{
Sebastian Frey's avatar
Sebastian Frey committed
38
			return currentMoveState;
39
		}
40 41 42 43 44 45 46 47 48

		public void ChangeCharges(int amount)
		{
			if ((charges + amount) > 5)
			{
				charges = 5;
			} else if ((charges + amount) <= 0)
			{
				charges = 0;
mthiele2's avatar
mthiele2 committed
49
				UpdateElement(InfusedElement.None);
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
			}
			else
			{
				charges += amount;
			}
		}

		public int GetCharges()
		{
			return charges;
		}

		public InfusedElement GetCurrentElement()
		{
			return currentInfusedElement;
		}
Sebastian Frey's avatar
Sebastian Frey committed
66
	}
67

Sebastian Frey's avatar
Sebastian Frey committed
68 69 70 71 72 73 74 75
	public enum InfusedElement
	{
		None,
		Fire,
		Water,
		Earth,
		Air
	}
76
}