-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from SideQuestVR/dev-merge
Dev merge
Showing
28 changed files
with
2,097 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
using Banter.SDK; | ||
|
||
namespace Banter.SDKEditor | ||
{ | ||
[CustomEditor(typeof(BanterGrabHandle))] | ||
public class BanterGrabHandleEditor : Editor | ||
{ | ||
void OnEnable() | ||
{ | ||
if (target is BanterGrabHandle) | ||
{ | ||
var script = (BanterGrabHandle)target; | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
var path = AssetDatabase.GetAssetPath(script); | ||
} | ||
} | ||
public override bool UseDefaultMargins() => false; | ||
public override VisualElement CreateInspectorGUI() | ||
{ | ||
var script = (BanterGrabHandle)target; | ||
Editor editor = Editor.CreateEditor(script); | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
VisualElement myInspector = new VisualElement(); | ||
|
||
var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector"); | ||
myInspector.styleSheets.Add(_mainWindowStyleSheet); | ||
|
||
var title = new Label("PROPERTIES SEEN BY JS"); | ||
title.style.fontSize = 14; | ||
myInspector.Add(title); | ||
var seeFields = new Label("grabType, grabRadius, "); | ||
seeFields.style.unityFontStyleAndWeight = FontStyle.Bold; | ||
seeFields.style.flexWrap = Wrap.Wrap; | ||
seeFields.style.whiteSpace = WhiteSpace.Normal; | ||
seeFields.style.marginBottom = 10; | ||
seeFields.style.marginTop = 10; | ||
seeFields.style.color = Color.gray; | ||
myInspector.Add(seeFields); | ||
|
||
//#if BANTER_EDITOR | ||
var foldout = new Foldout(); | ||
foldout.text = "Available Properties"; | ||
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); }); | ||
foldout.value = false; | ||
foldout.Add(inspectorIMGUI); | ||
myInspector.Add(foldout); | ||
//#endif | ||
|
||
return myInspector; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
using Banter.SDK; | ||
|
||
namespace Banter.SDKEditor | ||
{ | ||
[CustomEditor(typeof(BanterHeldEvents))] | ||
public class BanterHeldEventsEditor : Editor | ||
{ | ||
void OnEnable() | ||
{ | ||
if (target is BanterHeldEvents) | ||
{ | ||
var script = (BanterHeldEvents)target; | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
var path = AssetDatabase.GetAssetPath(script); | ||
} | ||
} | ||
public override bool UseDefaultMargins() => false; | ||
public override VisualElement CreateInspectorGUI() | ||
{ | ||
var script = (BanterHeldEvents)target; | ||
Editor editor = Editor.CreateEditor(script); | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
VisualElement myInspector = new VisualElement(); | ||
|
||
var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector"); | ||
myInspector.styleSheets.Add(_mainWindowStyleSheet); | ||
|
||
var title = new Label("PROPERTIES SEEN BY JS"); | ||
title.style.fontSize = 14; | ||
myInspector.Add(title); | ||
var seeFields = new Label("sensitivity, fireRate, auto, blockThumbstick, blockPrimary, blockSecondary, blockThumbstickClick, "); | ||
seeFields.style.unityFontStyleAndWeight = FontStyle.Bold; | ||
seeFields.style.flexWrap = Wrap.Wrap; | ||
seeFields.style.whiteSpace = WhiteSpace.Normal; | ||
seeFields.style.marginBottom = 10; | ||
seeFields.style.marginTop = 10; | ||
seeFields.style.color = Color.gray; | ||
myInspector.Add(seeFields); | ||
|
||
//#if BANTER_EDITOR | ||
var foldout = new Foldout(); | ||
foldout.text = "Available Properties"; | ||
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); }); | ||
foldout.value = false; | ||
foldout.Add(inspectorIMGUI); | ||
myInspector.Add(foldout); | ||
//#endif | ||
|
||
return myInspector; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
using Banter.SDK; | ||
|
||
namespace Banter.SDKEditor | ||
{ | ||
[CustomEditor(typeof(BanterWorldObject))] | ||
public class BanterWorldObjectEditor : Editor | ||
{ | ||
void OnEnable() | ||
{ | ||
if (target is BanterWorldObject) | ||
{ | ||
var script = (BanterWorldObject)target; | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
var path = AssetDatabase.GetAssetPath(script); | ||
} | ||
} | ||
public override bool UseDefaultMargins() => false; | ||
public override VisualElement CreateInspectorGUI() | ||
{ | ||
var script = (BanterWorldObject)target; | ||
Editor editor = Editor.CreateEditor(script); | ||
// script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; | ||
VisualElement myInspector = new VisualElement(); | ||
|
||
var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector"); | ||
myInspector.styleSheets.Add(_mainWindowStyleSheet); | ||
|
||
|
||
//#if BANTER_EDITOR | ||
var foldout = new Foldout(); | ||
foldout.text = "Available Properties"; | ||
IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); }); | ||
foldout.value = false; | ||
foldout.Add(inspectorIMGUI); | ||
myInspector.Add(foldout); | ||
//#endif | ||
|
||
return myInspector; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
public enum BanterGrabType | ||
{ | ||
Point, | ||
Cylinder, | ||
Ball, | ||
Soft | ||
} | ||
namespace Banter.SDK | ||
{ | ||
|
||
[RequireComponent(typeof(BanterObjectId))] | ||
[WatchComponent] | ||
public class BanterGrabHandle : BanterComponentBase | ||
{ | ||
[See(initial = "0")] public BanterGrabType grabType; | ||
[See(initial = "0.01")] public float grabRadius = 0.01f; | ||
public override void DestroyStuff() | ||
{ | ||
// throw new NotImplementedException(); | ||
} | ||
|
||
public override void StartStuff() | ||
{ | ||
scene.events.OnGrabHandle.Invoke(this); | ||
// throw new NotImplementedException(); | ||
} | ||
|
||
public void UpdateCallback(List<PropertyName> changedProperties) | ||
{ | ||
// SetupPhysicMaterial(changedProperties); | ||
} | ||
// BANTER COMPILED CODE | ||
BanterScene scene; | ||
bool alreadyStarted = false; | ||
void Start() | ||
{ | ||
Init(); | ||
StartStuff(); | ||
} | ||
|
||
public override void ReSetup() | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>() { PropertyName.grabType, PropertyName.grabRadius, }; | ||
UpdateCallback(changedProperties); | ||
} | ||
|
||
public override void Init(List<object> constructorProperties = null) | ||
{ | ||
scene = BanterScene.Instance(); | ||
if (alreadyStarted) { return; } | ||
alreadyStarted = true; | ||
scene.RegisterBanterMonoscript(gameObject.GetInstanceID(), GetInstanceID(), ComponentType.BanterGrabHandle); | ||
|
||
|
||
oid = gameObject.GetInstanceID(); | ||
cid = GetInstanceID(); | ||
|
||
if (constructorProperties != null) | ||
{ | ||
Deserialise(constructorProperties); | ||
} | ||
|
||
SyncProperties(true); | ||
|
||
} | ||
|
||
void Awake() | ||
{ | ||
BanterScene.Instance().RegisterComponentOnMainThread(gameObject, this); | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
scene.UnregisterComponentOnMainThread(gameObject, this); | ||
|
||
DestroyStuff(); | ||
} | ||
|
||
public override object CallMethod(string methodName, List<object> parameters) | ||
{ | ||
return null; | ||
} | ||
|
||
public override void Deserialise(List<object> values) | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>(); | ||
for (int i = 0; i < values.Count; i++) | ||
{ | ||
if (values[i] is BanterInt) | ||
{ | ||
var valgrabType = (BanterInt)values[i]; | ||
if (valgrabType.n == PropertyName.grabType) | ||
{ | ||
grabType = (BanterGrabType)valgrabType.x; | ||
changedProperties.Add(PropertyName.grabType); | ||
} | ||
} | ||
if (values[i] is BanterFloat) | ||
{ | ||
var valgrabRadius = (BanterFloat)values[i]; | ||
if (valgrabRadius.n == PropertyName.grabRadius) | ||
{ | ||
grabRadius = valgrabRadius.x; | ||
changedProperties.Add(PropertyName.grabRadius); | ||
} | ||
} | ||
} | ||
if (values.Count > 0) { UpdateCallback(changedProperties); } | ||
} | ||
|
||
public override void SyncProperties(bool force = false, Action callback = null) | ||
{ | ||
var updates = new List<BanterComponentPropertyUpdate>(); | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.grabType, | ||
type = PropertyType.Int, | ||
value = grabType, | ||
componentType = ComponentType.BanterGrabHandle, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.grabRadius, | ||
type = PropertyType.Float, | ||
value = grabRadius, | ||
componentType = ComponentType.BanterGrabHandle, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
scene.SetFromUnityProperties(updates, callback); | ||
} | ||
|
||
public override void WatchProperties(PropertyName[] properties) | ||
{ | ||
} | ||
// END BANTER COMPILED CODE | ||
} | ||
} |
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using Pixeye.Unity; | ||
using UnityEngine; | ||
using UnityEngine.Events; | ||
|
||
namespace Banter.SDK | ||
{ | ||
|
||
[RequireComponent(typeof(BanterObjectId))] | ||
[WatchComponent] | ||
public class BanterHeldEvents : BanterComponentBase | ||
{ | ||
|
||
[See(initial = "0.5")] public float sensitivity = 0.5f; | ||
[See(initial = "0.1")] public float fireRate = 0.1f; | ||
[See(initial = "false")] public bool auto = false; | ||
[See(initial = "false")] public bool blockThumbstick = false; | ||
[See(initial = "false")] public bool blockPrimary = false; | ||
[See(initial = "false")] public bool blockSecondary = false; | ||
[See(initial = "false")] public bool blockThumbstickClick = false; | ||
|
||
public override void DestroyStuff() | ||
{ | ||
// throw new NotImplementedException(); | ||
} | ||
|
||
|
||
public override void StartStuff() | ||
{ | ||
if (!gameObject.GetComponent<BanterPlayerEvents>()) | ||
gameObject.AddComponent<BanterPlayerEvents>(); | ||
|
||
scene.events.OnHeldEvents.Invoke(this); | ||
} | ||
|
||
public void UpdateCallback(List<PropertyName> changedProperties) | ||
{ | ||
// SetupPhysicMaterial(changedProperties); | ||
} | ||
// BANTER COMPILED CODE | ||
BanterScene scene; | ||
bool alreadyStarted = false; | ||
void Start() | ||
{ | ||
Init(); | ||
StartStuff(); | ||
} | ||
|
||
public override void ReSetup() | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>() { PropertyName.sensitivity, PropertyName.fireRate, PropertyName.auto, PropertyName.blockThumbstick, PropertyName.blockPrimary, PropertyName.blockSecondary, PropertyName.blockThumbstickClick, }; | ||
UpdateCallback(changedProperties); | ||
} | ||
|
||
public override void Init(List<object> constructorProperties = null) | ||
{ | ||
scene = BanterScene.Instance(); | ||
if (alreadyStarted) { return; } | ||
alreadyStarted = true; | ||
scene.RegisterBanterMonoscript(gameObject.GetInstanceID(), GetInstanceID(), ComponentType.BanterHeldEvents); | ||
|
||
|
||
oid = gameObject.GetInstanceID(); | ||
cid = GetInstanceID(); | ||
|
||
if (constructorProperties != null) | ||
{ | ||
Deserialise(constructorProperties); | ||
} | ||
|
||
SyncProperties(true); | ||
|
||
} | ||
|
||
void Awake() | ||
{ | ||
BanterScene.Instance().RegisterComponentOnMainThread(gameObject, this); | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
scene.UnregisterComponentOnMainThread(gameObject, this); | ||
|
||
DestroyStuff(); | ||
} | ||
|
||
public override object CallMethod(string methodName, List<object> parameters) | ||
{ | ||
return null; | ||
} | ||
|
||
public override void Deserialise(List<object> values) | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>(); | ||
for (int i = 0; i < values.Count; i++) | ||
{ | ||
if (values[i] is BanterFloat) | ||
{ | ||
var valsensitivity = (BanterFloat)values[i]; | ||
if (valsensitivity.n == PropertyName.sensitivity) | ||
{ | ||
sensitivity = valsensitivity.x; | ||
changedProperties.Add(PropertyName.sensitivity); | ||
} | ||
} | ||
if (values[i] is BanterFloat) | ||
{ | ||
var valfireRate = (BanterFloat)values[i]; | ||
if (valfireRate.n == PropertyName.fireRate) | ||
{ | ||
fireRate = valfireRate.x; | ||
changedProperties.Add(PropertyName.fireRate); | ||
} | ||
} | ||
if (values[i] is BanterBool) | ||
{ | ||
var valauto = (BanterBool)values[i]; | ||
if (valauto.n == PropertyName.auto) | ||
{ | ||
auto = valauto.x; | ||
changedProperties.Add(PropertyName.auto); | ||
} | ||
} | ||
if (values[i] is BanterBool) | ||
{ | ||
var valblockThumbstick = (BanterBool)values[i]; | ||
if (valblockThumbstick.n == PropertyName.blockThumbstick) | ||
{ | ||
blockThumbstick = valblockThumbstick.x; | ||
changedProperties.Add(PropertyName.blockThumbstick); | ||
} | ||
} | ||
if (values[i] is BanterBool) | ||
{ | ||
var valblockPrimary = (BanterBool)values[i]; | ||
if (valblockPrimary.n == PropertyName.blockPrimary) | ||
{ | ||
blockPrimary = valblockPrimary.x; | ||
changedProperties.Add(PropertyName.blockPrimary); | ||
} | ||
} | ||
if (values[i] is BanterBool) | ||
{ | ||
var valblockSecondary = (BanterBool)values[i]; | ||
if (valblockSecondary.n == PropertyName.blockSecondary) | ||
{ | ||
blockSecondary = valblockSecondary.x; | ||
changedProperties.Add(PropertyName.blockSecondary); | ||
} | ||
} | ||
if (values[i] is BanterBool) | ||
{ | ||
var valblockThumbstickClick = (BanterBool)values[i]; | ||
if (valblockThumbstickClick.n == PropertyName.blockThumbstickClick) | ||
{ | ||
blockThumbstickClick = valblockThumbstickClick.x; | ||
changedProperties.Add(PropertyName.blockThumbstickClick); | ||
} | ||
} | ||
} | ||
if (values.Count > 0) { UpdateCallback(changedProperties); } | ||
} | ||
|
||
public override void SyncProperties(bool force = false, Action callback = null) | ||
{ | ||
var updates = new List<BanterComponentPropertyUpdate>(); | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.sensitivity, | ||
type = PropertyType.Float, | ||
value = sensitivity, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.fireRate, | ||
type = PropertyType.Float, | ||
value = fireRate, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.auto, | ||
type = PropertyType.Bool, | ||
value = auto, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.blockThumbstick, | ||
type = PropertyType.Bool, | ||
value = blockThumbstick, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.blockPrimary, | ||
type = PropertyType.Bool, | ||
value = blockPrimary, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.blockSecondary, | ||
type = PropertyType.Bool, | ||
value = blockSecondary, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
if (force) | ||
{ | ||
updates.Add(new BanterComponentPropertyUpdate() | ||
{ | ||
name = PropertyName.blockThumbstickClick, | ||
type = PropertyType.Bool, | ||
value = blockThumbstickClick, | ||
componentType = ComponentType.BanterHeldEvents, | ||
oid = oid, | ||
cid = cid | ||
}); | ||
} | ||
scene.SetFromUnityProperties(updates, callback); | ||
} | ||
|
||
public override void WatchProperties(PropertyName[] properties) | ||
{ | ||
} | ||
// END BANTER COMPILED CODE | ||
} | ||
} |
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Banter.SDK | ||
{ | ||
|
||
[RequireComponent(typeof(BanterObjectId))] | ||
[WatchComponent] | ||
public class BanterWorldObject : BanterComponentBase | ||
{ | ||
[Method] | ||
public void _CollectColliders() | ||
{ | ||
scene.events.OnWorldObjectCollectColliders.Invoke(this); | ||
} | ||
|
||
public override void DestroyStuff() | ||
{ | ||
// throw new NotImplementedException(); | ||
} | ||
|
||
public override void StartStuff() | ||
{ | ||
scene.events.OnWorldObject.Invoke(this); | ||
} | ||
|
||
public void UpdateCallback(List<PropertyName> changedProperties) | ||
{ | ||
// SetupPhysicMaterial(changedProperties); | ||
} | ||
// BANTER COMPILED CODE | ||
BanterScene scene; | ||
bool alreadyStarted = false; | ||
void Start() | ||
{ | ||
Init(); | ||
StartStuff(); | ||
} | ||
|
||
public override void ReSetup() | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>() { }; | ||
UpdateCallback(changedProperties); | ||
} | ||
|
||
public override void Init(List<object> constructorProperties = null) | ||
{ | ||
scene = BanterScene.Instance(); | ||
if (alreadyStarted) { return; } | ||
alreadyStarted = true; | ||
scene.RegisterBanterMonoscript(gameObject.GetInstanceID(), GetInstanceID(), ComponentType.BanterWorldObject); | ||
|
||
|
||
oid = gameObject.GetInstanceID(); | ||
cid = GetInstanceID(); | ||
|
||
if (constructorProperties != null) | ||
{ | ||
Deserialise(constructorProperties); | ||
} | ||
|
||
SyncProperties(true); | ||
|
||
} | ||
|
||
void Awake() | ||
{ | ||
BanterScene.Instance().RegisterComponentOnMainThread(gameObject, this); | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
scene.UnregisterComponentOnMainThread(gameObject, this); | ||
|
||
DestroyStuff(); | ||
} | ||
|
||
void CollectColliders() | ||
{ | ||
_CollectColliders(); | ||
} | ||
public override object CallMethod(string methodName, List<object> parameters) | ||
{ | ||
|
||
if (methodName == "CollectColliders" && parameters.Count == 0) | ||
{ | ||
CollectColliders(); | ||
return null; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
|
||
public override void Deserialise(List<object> values) | ||
{ | ||
List<PropertyName> changedProperties = new List<PropertyName>(); | ||
for (int i = 0; i < values.Count; i++) | ||
{ | ||
} | ||
if (values.Count > 0) { UpdateCallback(changedProperties); } | ||
} | ||
|
||
public override void SyncProperties(bool force = false, Action callback = null) | ||
{ | ||
var updates = new List<BanterComponentPropertyUpdate>(); | ||
scene.SetFromUnityProperties(updates, callback); | ||
} | ||
|
||
public override void WatchProperties(PropertyName[] properties) | ||
{ | ||
} | ||
// END BANTER COMPILED CODE | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Scripts/Scene/Components/BanterWorldObject.cs.meta
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters