merge projects and arrange script folders

This commit is contained in:
voffka81
2022-08-17 11:14:32 +03:00
parent beea2145cb
commit c0ea0addcb
35 changed files with 608 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5c9921d88d8517d4481f72631d55168c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e8ace0e753f18d41ae7374b31260efd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+15
View File
@@ -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();
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e13454be9a4755a4cb902ce4492c0d47
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -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);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88b69afebf64e464981dc504941a0887
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -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);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 986e2b29060766347a43dc46e30a648e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -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();
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a40c2851bc6f1454789ac4d529a148c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cdd8a9c61eebf384796c7c94453d3255
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+30
View File
@@ -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<string, BaseAction> OptionsList;
protected BaseCell()
{
OptionsList = new Dictionary<string, BaseAction>();
}
protected abstract void BuildOptionsList();
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8087167db9f5271408218993b0473a69
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -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));
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61bf941dbcbd36f48bdd8f30b1b6c1f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+12
View File
@@ -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));
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1a4df4c0f11d1a043b36f4ea6a31e4d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+32
View File
@@ -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);
}
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e34d78101f2c2b842864fce206379a7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+59
View File
@@ -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<Transform> 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();
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a17411f0f5c4b764fb4afd65c74cbcb5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+20
View File
@@ -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()
{
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 90d55fcea99d3d14db40fb1ce5deca37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+16
View File
@@ -0,0 +1,16 @@
using Assets.Scripts.Buildings;
using System.Collections.Generic;
public class Map
{
private List<BaseCell> Cells;
public Map()
{
Cells = new List<BaseCell>
{
new House(),
new Burger()
};
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f94ae0990a1cfa4b9ed0aebebde8681
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+72
View File
@@ -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<Transform> 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;
}
}
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bcc540dae28291b498a66c667c22bc3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+65
View File
@@ -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;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c802a0d9d32b0c04b841113e87b83e4b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+41
View File
@@ -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;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d941c5108c66a44da3ab31f96e40d8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: