Skip to content

Commit

Permalink
flesh it out more
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Jul 22, 2024
1 parent 0b4a771 commit f1ace2c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down
4 changes: 4 additions & 0 deletions Winch.Examples/ExampleItems/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public static void Initialize()
var testAbility = AbilityUtil.RegisterModdedAbilityType<TestAbility>("exampleitems.testability");

var testWorldEvent = WorldEventUtil.RegisterModdedWorldEventType<TestWorldEvent>("exampleitems.testworldevent");
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.RemoveComponent<Collider>();
sphere.GetComponent<MeshRenderer>().sharedMaterial = new Material(Shader.Find("Shader Graphs/Lit_Shader"));
sphere.transform.SetParent(testWorldEvent.transform, false);

var prefab = GameObject.CreatePrimitive(PrimitiveType.Cube).Prefabitize();
prefab.RemoveComponent<Collider>();
Expand Down
5 changes: 4 additions & 1 deletion Winch.Examples/ExampleItems/TestWorldEvent.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
using Winch.Components;
using Winch.Core;

namespace ExampleItems
{
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();
}
}
}
3 changes: 3 additions & 0 deletions Winch/Util/WinchExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,9 @@ public static T Rename<T>(this T target, string name) where T : UnityEngine.Obje
return target;
}

public static void Destroy<T>(this T target) where T : UnityEngine.Object => UnityEngine.Object.Destroy(target);
public static void DestroyImmediate<T>(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;
Expand Down

0 comments on commit f1ace2c

Please sign in to comment.