diff --git a/Winch.Examples/ExampleItems/Assets/WorldEvents/Dynamic/exampleitems.testworldevent.json b/Winch.Examples/ExampleItems/Assets/WorldEvents/Dynamic/exampleitems.testworldevent.json index d726615c..5fb653e2 100644 --- a/Winch.Examples/ExampleItems/Assets/WorldEvents/Dynamic/exampleitems.testworldevent.json +++ b/Winch.Examples/ExampleItems/Assets/WorldEvents/Dynamic/exampleitems.testworldevent.json @@ -1,9 +1,28 @@ { "eventType": "SPAWN_PREFAB", + "weight": 100, + "spawnStartTime": 0, + "spawnEndTime": 1, + "playerSpawnOffset": { + "x": 5, + "y": 5, + "z": 5 + }, + "dispelByBanish": true, + "dispelByFoghorn": true, + "foghornDispelTime": 1.5, + "foghornDispelCount": 3, + "doSafeZoneHitCheck": true, + "allowInPassiveMode": false, + "hasMinDepth": true, + "minDepth": 0.03, + "minSanity": 0, + "maxSanity": 1, + "forbiddenZones": [ "THE_MARROWS", "STELLAR_BASIN", "TWISTED_STRAND", "DEVILS_SPINE", "OPEN_OCEAN", "PALE_REACH" ], "repeatDelay": { - "NORMAL": 1, - "PASSIVE": 1, - "NIGHTMARE": 1 + "NORMAL": 0.1, + "PASSIVE": 0.1, + "NIGHTMARE": 0.1 }, "itemInventoryConditions": [ { diff --git a/Winch.Examples/ExampleItems/Loader.cs b/Winch.Examples/ExampleItems/Loader.cs index 11bbf026..2a6f9a75 100644 --- a/Winch.Examples/ExampleItems/Loader.cs +++ b/Winch.Examples/ExampleItems/Loader.cs @@ -10,6 +10,10 @@ public static void Initialize() var testAbility = AbilityUtil.RegisterModdedAbilityType("exampleitems.testability"); var testWorldEvent = WorldEventUtil.RegisterModdedWorldEventType("exampleitems.testworldevent"); + var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); + sphere.RemoveComponent(); + sphere.GetComponent().sharedMaterial = new Material(Shader.Find("Shader Graphs/Lit_Shader")); + sphere.transform.SetParent(testWorldEvent.transform, false); var prefab = GameObject.CreatePrimitive(PrimitiveType.Cube).Prefabitize(); prefab.RemoveComponent(); diff --git a/Winch.Examples/ExampleItems/TestWorldEvent.cs b/Winch.Examples/ExampleItems/TestWorldEvent.cs index 972e5af6..56a49e52 100644 --- a/Winch.Examples/ExampleItems/TestWorldEvent.cs +++ b/Winch.Examples/ExampleItems/TestWorldEvent.cs @@ -1,4 +1,5 @@ using Winch.Components; +using Winch.Core; namespace ExampleItems { @@ -6,14 +7,16 @@ public class TestWorldEvent : ModdedWorldEvent { public override void Activate() { + WinchCore.Log.Debug("[TestWorldEvent] Activate()"); base.Activate(); - this.RequestEventFinish(); } public override void RequestEventFinish() { + WinchCore.Log.Debug("[TestWorldEvent] RequestEventFinish()"); base.RequestEventFinish(); this.EventFinished(); + gameObject.Destroy(); } } } diff --git a/Winch/Util/WinchExtensions.cs b/Winch/Util/WinchExtensions.cs index 40cfd65a..2a46b955 100644 --- a/Winch/Util/WinchExtensions.cs +++ b/Winch/Util/WinchExtensions.cs @@ -759,6 +759,9 @@ public static T Rename(this T target, string name) where T : UnityEngine.Obje return target; } + public static void Destroy(this T target) where T : UnityEngine.Object => UnityEngine.Object.Destroy(target); + public static void DestroyImmediate(this T target) where T : UnityEngine.Object => UnityEngine.Object.DestroyImmediate(target); + public static void SmoothLookDir(this GameObject go, Vector3 direction, float dt, float angularVelocity) { var start = go.transform.rotation;