added: World, Zone and ZoneEvent classes for world systems
This commit is contained in:
21
Assets/Scripts/World/World.cs
Normal file
21
Assets/Scripts/World/World.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Reset.World{
|
||||||
|
public class World{
|
||||||
|
public List<Zone> zones = new List<Zone>();
|
||||||
|
public List<ZoneEvent> activeEvents = new List<ZoneEvent>();
|
||||||
|
|
||||||
|
public static List<ZoneEvent> ZoneEventsMasterList;
|
||||||
|
|
||||||
|
void Start(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/World/World.cs.meta
Normal file
2
Assets/Scripts/World/World.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d524946cf105ebe47ab710cddf19e4f8
|
||||||
27
Assets/Scripts/World/Zone.cs
Normal file
27
Assets/Scripts/World/Zone.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Reset.World;
|
||||||
|
using UnityEngine;
|
||||||
|
public class Zone : MonoBehaviour{
|
||||||
|
public ZoneEvent activeEvent;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryNewEvent(){
|
||||||
|
int eventIndex = Random.Range(0, World.ZoneEventsMasterList.Count);
|
||||||
|
|
||||||
|
if (Random.value * 100 < World.ZoneEventsMasterList[eventIndex].eventRarity) {
|
||||||
|
activeEvent = World.ZoneEventsMasterList[eventIndex];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/World/Zone.cs.meta
Normal file
2
Assets/Scripts/World/Zone.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 787d3d76f34dc6d40aeac24af98bc27d
|
||||||
9
Assets/Scripts/World/ZoneEvent.cs
Normal file
9
Assets/Scripts/World/ZoneEvent.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
|
||||||
|
namespace Reset.World{
|
||||||
|
public class ZoneEvent{
|
||||||
|
[PropertyRange(0, 100)]
|
||||||
|
public float eventRarity;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/World/ZoneEvent.cs.meta
Normal file
3
Assets/Scripts/World/ZoneEvent.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b045a48fc77475389d1f1eca177aed9
|
||||||
|
timeCreated: 1759349742
|
||||||
Reference in New Issue
Block a user