diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 00000000..7e273c50 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5c9921d88d8517d4481f72631d55168c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actions.meta b/Assets/Scripts/Actions.meta new file mode 100644 index 00000000..c86661fa --- /dev/null +++ b/Assets/Scripts/Actions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e8ace0e753f18d41ae7374b31260efd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actions/BaseAction.cs b/Assets/Scripts/Actions/BaseAction.cs new file mode 100644 index 00000000..7356b1f2 --- /dev/null +++ b/Assets/Scripts/Actions/BaseAction.cs @@ -0,0 +1,15 @@ +namespace Assets.Scripts.Actions +{ + public abstract class BaseAction + { + protected int DurationInTicks { get; } + protected int ElapsedTicks { get; } + + protected BaseAction(int durationTicks) + { + DurationInTicks = durationTicks; + } + + public abstract void ConsumeTick(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Actions/BaseAction.cs.meta b/Assets/Scripts/Actions/BaseAction.cs.meta new file mode 100644 index 00000000..d82790a5 --- /dev/null +++ b/Assets/Scripts/Actions/BaseAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e13454be9a4755a4cb902ce4492c0d47 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actions/Eat.cs b/Assets/Scripts/Actions/Eat.cs new file mode 100644 index 00000000..2a1ac84f --- /dev/null +++ b/Assets/Scripts/Actions/Eat.cs @@ -0,0 +1,17 @@ +namespace Assets.Scripts.Actions +{ + public class Eat : BaseAction + { + private PlayerController playerController; + private int energyPerTick; + public Eat(PlayerController player, int duration, int energyPerTick, double cost) : base(duration) + { + this.playerController = player; + this.energyPerTick = energyPerTick; + } + public override void ConsumeTick() + { + playerController.foodEnergy.increase(energyPerTick); + } + } +} diff --git a/Assets/Scripts/Actions/Eat.cs.meta b/Assets/Scripts/Actions/Eat.cs.meta new file mode 100644 index 00000000..8a4fdb80 --- /dev/null +++ b/Assets/Scripts/Actions/Eat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88b69afebf64e464981dc504941a0887 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actions/Relax.cs b/Assets/Scripts/Actions/Relax.cs new file mode 100644 index 00000000..89af0005 --- /dev/null +++ b/Assets/Scripts/Actions/Relax.cs @@ -0,0 +1,17 @@ +namespace Assets.Scripts.Actions +{ + public class Relax : BaseAction + { + private PlayerController _playerController; + private int _energyPerTick; + public Relax(PlayerController player, int duration, int energyPerTick) : base(duration) + { + _playerController = player; + _energyPerTick = energyPerTick; + } + public override void ConsumeTick() + { + _playerController.restEnergy.increase(_energyPerTick); + } + } +} diff --git a/Assets/Scripts/Actions/Relax.cs.meta b/Assets/Scripts/Actions/Relax.cs.meta new file mode 100644 index 00000000..46ad0b30 --- /dev/null +++ b/Assets/Scripts/Actions/Relax.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 986e2b29060766347a43dc46e30a648e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Actions/Work.cs b/Assets/Scripts/Actions/Work.cs new file mode 100644 index 00000000..3bb8ea73 --- /dev/null +++ b/Assets/Scripts/Actions/Work.cs @@ -0,0 +1,17 @@ +namespace Assets.Scripts.Actions +{ + public class Work : BaseAction + { + private PlayerController playerController; + private int energyPerTick; + public Work(PlayerController player, int duration, int energyPerTick) : base(duration) + { + this.playerController = player; + this.energyPerTick = energyPerTick; + } + public override void ConsumeTick() + { + throw new System.NotImplementedException(); + } + } +} diff --git a/Assets/Scripts/Actions/Work.cs.meta b/Assets/Scripts/Actions/Work.cs.meta new file mode 100644 index 00000000..aca3e4b7 --- /dev/null +++ b/Assets/Scripts/Actions/Work.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a40c2851bc6f1454789ac4d529a148c9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Buildings.meta b/Assets/Scripts/Buildings.meta new file mode 100644 index 00000000..bcb7a3e2 --- /dev/null +++ b/Assets/Scripts/Buildings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdd8a9c61eebf384796c7c94453d3255 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Buildings/Building.cs b/Assets/Scripts/Buildings/Building.cs new file mode 100644 index 00000000..468ce1d4 --- /dev/null +++ b/Assets/Scripts/Buildings/Building.cs @@ -0,0 +1,30 @@ +using Assets.Scripts.Actions; +using System.Collections.Generic; +using UnityEngine; + +namespace Assets.Scripts.Buildings +{ + public abstract class BaseCell : MonoBehaviour + { + public Dictionary OptionsList; + + protected BaseCell() + { + OptionsList = new Dictionary(); + } + + protected abstract void BuildOptionsList(); + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Buildings/Building.cs.meta b/Assets/Scripts/Buildings/Building.cs.meta new file mode 100644 index 00000000..5ff2f9e9 --- /dev/null +++ b/Assets/Scripts/Buildings/Building.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8087167db9f5271408218993b0473a69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Buildings/Burger.cs b/Assets/Scripts/Buildings/Burger.cs new file mode 100644 index 00000000..faff67c9 --- /dev/null +++ b/Assets/Scripts/Buildings/Burger.cs @@ -0,0 +1,17 @@ +using Assets.Scripts.Actions; + +namespace Assets.Scripts.Buildings +{ + public class Burger : BaseCell + { + protected override void BuildOptionsList() + { + OptionsList.Add("Hamburgers - 83$", new Eat(null, 6, 1, 83)); + OptionsList.Add("Cheesburger - 94$", new Eat(null, 6, 1, 94)); + OptionsList.Add("Astro chicken - 131$", new Eat(null, 6, 1, 131)); + OptionsList.Add("Fries - 68$", new Eat(null, 6, 1, 68)); + OptionsList.Add("Shakes - 108$", new Eat(null, 6, 1, 108)); + OptionsList.Add("Colas - 73$", new Eat(null, 6, 1, 73)); + } + } +} diff --git a/Assets/Scripts/Buildings/Burger.cs.meta b/Assets/Scripts/Buildings/Burger.cs.meta new file mode 100644 index 00000000..43435d87 --- /dev/null +++ b/Assets/Scripts/Buildings/Burger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61bf941dbcbd36f48bdd8f30b1b6c1f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Buildings/House.cs b/Assets/Scripts/Buildings/House.cs new file mode 100644 index 00000000..d9b4d736 --- /dev/null +++ b/Assets/Scripts/Buildings/House.cs @@ -0,0 +1,12 @@ +using Assets.Scripts.Actions; + +namespace Assets.Scripts.Buildings +{ + public class House : BaseCell + { + protected override void BuildOptionsList() + { + OptionsList.Add("Rest", new Relax(null, 6, 1)); + } + } +} diff --git a/Assets/Scripts/Buildings/House.cs.meta b/Assets/Scripts/Buildings/House.cs.meta new file mode 100644 index 00000000..243ffab9 --- /dev/null +++ b/Assets/Scripts/Buildings/House.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a4df4c0f11d1a043b36f4ea6a31e4d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/CharacterMovement.cs b/Assets/Scripts/CharacterMovement.cs new file mode 100644 index 00000000..9ed5edb4 --- /dev/null +++ b/Assets/Scripts/CharacterMovement.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.AI; + +public class CharacterMovement : MonoBehaviour +{ + public NavMeshAgent playerNavMeshAgent; + + public Camera playerCamera; + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if(Input.GetMouseButton(0)) + { + Ray myRay=playerCamera.ScreenPointToRay(Input.mousePosition); + RaycastHit hit; + + if(Physics.Raycast(myRay, out hit)) + { + playerNavMeshAgent.SetDestination(hit.point); + } + } + } +} diff --git a/Assets/Scripts/CharacterMovement.cs.meta b/Assets/Scripts/CharacterMovement.cs.meta new file mode 100644 index 00000000..ac75a879 --- /dev/null +++ b/Assets/Scripts/CharacterMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e34d78101f2c2b842864fce206379a7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/DateTimeController.cs b/Assets/Scripts/DateTimeController.cs similarity index 100% rename from Assets/DateTimeController.cs rename to Assets/Scripts/DateTimeController.cs diff --git a/Assets/DateTimeController.cs.meta b/Assets/Scripts/DateTimeController.cs.meta similarity index 100% rename from Assets/DateTimeController.cs.meta rename to Assets/Scripts/DateTimeController.cs.meta diff --git a/Assets/Scripts/FollowPath.cs b/Assets/Scripts/FollowPath.cs new file mode 100644 index 00000000..65dd318d --- /dev/null +++ b/Assets/Scripts/FollowPath.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using UnityEngine; + +public class FollowPath : MonoBehaviour +{ + public enum MovementTypes + { + Moveing, Lerping + + } + + public MovementTypes MovementType = MovementTypes.Moveing; + public MovementPath MyPath; + public float speed = 1; + public float maxDistance = .1f; + + public IEnumerator pointInPath; + + // Start is called before the first frame update + void Start() + { + if (MyPath == null) + { + Debug.Log("path not attached"); + return; + } + pointInPath = MyPath.GetNextPathPoint(); + pointInPath.MoveNext(); + if (pointInPath.Current == null) + { + Debug.Log("need points"); + return; + } + transform.position = pointInPath.Current.position; + } + + // Update is called once per frame + void Update() + { + if (pointInPath == null || pointInPath.Current == null) + { + return; + } + if (MovementType == MovementTypes.Moveing) + { + transform.position = Vector3.MoveTowards(transform.position, pointInPath.Current.position, Time.deltaTime * speed); + } + else + { + transform.position = Vector3.Lerp(transform.position, pointInPath.Current.position, Time.deltaTime * speed); + } + + var distanceSqare = (transform.position - pointInPath.Current.position).sqrMagnitude; + if (distanceSqare < maxDistance * maxDistance) + { + pointInPath.MoveNext(); + } + } +} diff --git a/Assets/Scripts/FollowPath.cs.meta b/Assets/Scripts/FollowPath.cs.meta new file mode 100644 index 00000000..fd82f13c --- /dev/null +++ b/Assets/Scripts/FollowPath.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a17411f0f5c4b764fb4afd65c74cbcb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs new file mode 100644 index 00000000..65523de7 --- /dev/null +++ b/Assets/Scripts/GameController.cs @@ -0,0 +1,20 @@ +using UnityEngine; + +public class GameController : MonoBehaviour +{ + public Map GameMap; + public PlayerController Player; + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + +} diff --git a/Assets/Scripts/GameController.cs.meta b/Assets/Scripts/GameController.cs.meta new file mode 100644 index 00000000..fdf9b940 --- /dev/null +++ b/Assets/Scripts/GameController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90d55fcea99d3d14db40fb1ce5deca37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Map.cs b/Assets/Scripts/Map.cs new file mode 100644 index 00000000..42c8e69e --- /dev/null +++ b/Assets/Scripts/Map.cs @@ -0,0 +1,16 @@ +using Assets.Scripts.Buildings; +using System.Collections.Generic; + +public class Map +{ + private List Cells; + + public Map() + { + Cells = new List + { + new House(), + new Burger() + }; + } +} diff --git a/Assets/Scripts/Map.cs.meta b/Assets/Scripts/Map.cs.meta new file mode 100644 index 00000000..f5ba9524 --- /dev/null +++ b/Assets/Scripts/Map.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f94ae0990a1cfa4b9ed0aebebde8681 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MovementPath.cs b/Assets/Scripts/MovementPath.cs new file mode 100644 index 00000000..9d804683 --- /dev/null +++ b/Assets/Scripts/MovementPath.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; +using UnityEngine; + +public class MovementPath : MonoBehaviour +{ + public enum PathTypes { lenear, loop } + public PathTypes PathType; + + public int movementDirection = 1; + public int movingTo = 0; + public Transform[] PathElements; + + public void OnDrawGizmos() + { + if (PathElements == null || PathElements.Length < 2) + return; + + for (int pointCount = 1; pointCount < PathElements.Length; pointCount++) + { + Gizmos.DrawLine(PathElements[pointCount - 1].position, PathElements[pointCount].position); + } + if (PathType == PathTypes.loop) + { + Gizmos.DrawLine(PathElements[0].position, PathElements[PathElements.Length - 1].position); + } + } + + public IEnumerator GetNextPathPoint() + { + Debug.Log("GetNextPathPoint"); + if (PathElements == null || PathElements.Length < 2) + { + Debug.Log("not enough path elements"); + yield break; + } + while (true) + { + yield return PathElements[movingTo]; + + if (PathElements.Length == 1) + { + + continue; + } + + if (PathType == PathTypes.lenear) + { + if (movingTo <= 0) + { + movementDirection = 1; + } + else if (movingTo >= PathElements.Length - 1) + { + movementDirection = -1; + } + } + movingTo = movingTo + movementDirection; + + if (PathType == PathTypes.loop) + { + if (movingTo >= PathElements.Length) + { + movingTo = 0; + } + if (movingTo < 0) + { + movingTo = PathElements.Length - 1; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MovementPath.cs.meta b/Assets/Scripts/MovementPath.cs.meta new file mode 100644 index 00000000..1c456ddc --- /dev/null +++ b/Assets/Scripts/MovementPath.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bcc540dae28291b498a66c667c22bc3a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs new file mode 100644 index 00000000..25b100c9 --- /dev/null +++ b/Assets/Scripts/PlayerController.cs @@ -0,0 +1,65 @@ +using UnityEngine; + +public class PlayerController : MonoBehaviour +{ + public Stat money = new Stat("Money", 1000.00); + public Stat rentAccount = new Stat("Rent Account", 0); + public Stat foodEnergy = new Stat("Food Energy", 0); + public Stat restEnergy = new Stat("Rest Energy", 0); + + // bank + public Stat bankAccount = new Stat("Bank Account", 0); + + // jobs + public Stat job = new Stat("Unemployed", 0); + + // Knowledge for University Jobs + public Stat literatureKnowledge = new Stat("LiteratureKnowledge", 0); + public Stat mathematicsKnowledge = new Stat("MathematicsKnowledge", 0); + public Stat computerScienceKnowledge = new Stat("ComputerScienceKnowledge", 0); + + // Knowledge for Factory Jobs + public Stat electronicsKnowledge = new Stat("ElectronicsKnowledge", 0); + public Stat roboticsKnowledge = new Stat("RoboticsKnowledge", 0); + public Stat industrialDesignKnowledge = new Stat("IndustrialDesignKnowledge", 0); + + public Stat careerPoints = new Stat("careerPoints", 0); + + // Achievements - to WIN the game + public Stat whealthAchievement = new Stat("whealthAchievement", 999999); + public Stat educationAchievement = new Stat("educationAchievement", 999999); + public Stat careerAchievement = new Stat("careerAchievement", 999999); + public Stat happinessAchievement = new Stat("happinessAchievement", 999999); + + // Inventory items + public Stat freezerItem = new Stat("Freezer Item", 400, 1); + public Stat clothesItem = new Stat("Clothes Item", 200, 3); + public Stat booksItem = new Stat("Books Item", 150, 2); + public Stat tvItem = new Stat("Tv Item", 1500, 1); + public Stat laptopItem = new Stat("Laptop Item", 3000, 1); + + + private int _day; + public int Clock; + + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + + public void StartNewDay() + { + Clock = 24; + } + + +} diff --git a/Assets/Scripts/PlayerController.cs.meta b/Assets/Scripts/PlayerController.cs.meta new file mode 100644 index 00000000..9d3ff788 --- /dev/null +++ b/Assets/Scripts/PlayerController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c802a0d9d32b0c04b841113e87b83e4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/QuestionDialogUI.cs b/Assets/Scripts/QuestionDialogUI.cs similarity index 100% rename from Assets/QuestionDialogUI.cs rename to Assets/Scripts/QuestionDialogUI.cs diff --git a/Assets/QuestionDialogUI.cs.meta b/Assets/Scripts/QuestionDialogUI.cs.meta similarity index 100% rename from Assets/QuestionDialogUI.cs.meta rename to Assets/Scripts/QuestionDialogUI.cs.meta diff --git a/Assets/Scripts/Stat.cs b/Assets/Scripts/Stat.cs new file mode 100644 index 00000000..e6b64718 --- /dev/null +++ b/Assets/Scripts/Stat.cs @@ -0,0 +1,41 @@ +public class Stat +{ + public string Name { get; set; } + public double Value { get; set; } + public double Price { get; set; } + public double Quantity { get; set; } + + public Stat(string name, double startValue) + { + Name = name; + Value = startValue; + } + + public Stat(string name, double price, double quantity) + { + Name = name; + Price = price; + Quantity = quantity; + } + + public void increase(double byAmount) + { + Value += byAmount; + } + + public bool deduct(double amount) + { + if (Value >= amount) + { + Value -= amount; + return true; + } + return false; + } + + public void forceDeduct(double amount) + { + Value -= amount; + } + +} diff --git a/Assets/Scripts/Stat.cs.meta b/Assets/Scripts/Stat.cs.meta new file mode 100644 index 00000000..24455f02 --- /dev/null +++ b/Assets/Scripts/Stat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d941c5108c66a44da3ab31f96e40d8e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: