public LuaWTBObject CreatePart(int partType, Vector3?position = null, Vector3?angles = null) { LuaWTBObject luaWTBO = CreateObject(Task.builderTransform.GetCreateObject(partType), position, angles); luaWTBO.visible = true; return(luaWTBO); }
/// <summary> the specific "Create"s use this abstracted one </summary> LuaWTBObject CreateObject(WTBObject _wtbo, Vector3?_position, Vector3?_angles) { if (!PhotonNetwork.isMasterClient) { throw new ScriptRuntimeException("You can only create parts on the host"); } if (_position == null) { _position = Vector3.zero; } if (_angles == null) { _angles = Vector3.zero; } LuaWTBObject spawned = Task.GetOrMakeLuaPart(_wtbo); spawned.position = (Vector3)_position; spawned.angles = (Vector3)_angles; spawned.WTBObject.GameObject.GetComponentInChildren <MeshRenderer>().enabled = true; Camera.main.GetComponent <MasterCamera>().luaRuntimeCreatedObjectList.Add(_wtbo); return(spawned); }
public void AttachToPlayer(LuaPlayer _lp, LuaWTBObject _lwtbo, string bone = "Head", Vector3?offset = null) { if (offset == null) { offset = Vector3.zero; } Transform boneTransform = null; foreach (Renderer child in _lp.playerObject.GetComponentsInChildren <SkinnedMeshRenderer>()) { if (child.transform.name == bone) { boneTransform = child.transform; } } if (boneTransform != null) { if (_lwtbo.WTBObject.GetComponent <Rigidbody>()) { Destroy(_lwtbo.WTBObject.GetComponent <Rigidbody>()); } _lwtbo.WTBObject.GameObject.transform.position = boneTransform.position + (Vector3)offset; _lwtbo.WTBObject.GameObject.transform.SetParent(boneTransform); _lwtbo.WTBObject.gameObject.layer = LayerMask.NameToLayer("Player"); } else { throw new ScriptRuntimeException("No bone found"); } }
public LuaWTBObject PartByName(string name) { foreach (WTBObject t in FindObjectsOfType <WTBObject>()) { LuaWTBObject lwtbo = Task.GetOrMakeLuaPart(t); if (lwtbo.name == name) { return(Task.GetOrMakeLuaPart(t)); } } return(null); }
public LuaWTBObject ChildByName(string name) { List <LuaWTBObject> l_transforms = new List <LuaWTBObject>(); foreach (WTBObject wtbo in this.WTBObject.GetChildrenAll()) { LuaWTBObject lwtbo = Task.GetOrMakeLuaPart(wtbo); if (lwtbo != null && lwtbo.name == name) { return(lwtbo); } } return(null); }
public List <LuaWTBObject> ChildrenByName(string name) { List <LuaWTBObject> l_transforms = new List <LuaWTBObject>(); foreach (int ci in this.WTBObject.children) { WTBObject wtbo = Task.builderTransform.WTBObjectByIndex[ci]; LuaWTBObject lwtbo = Task.GetOrMakeLuaPart(wtbo); if (lwtbo != null && lwtbo.name == name) { l_transforms.Add(lwtbo); } } return(l_transforms); }
public List <LuaWTBObject> PartsByName(string name) { List <LuaWTBObject> partsList = new List <LuaWTBObject>(); foreach (WTBObject t in FindObjectsOfType <WTBObject>()) { LuaWTBObject lwtbo = Task.GetOrMakeLuaPart(t); if (lwtbo.name == name) { partsList.Add(Task.GetOrMakeLuaPart(t)); } } return(partsList); }
public void UpdateOnClients(LuaWTBObject objectToUpdate) { if (!PhotonNetwork.isMasterClient) { return; } if (objectToUpdate.WTBObject == null) { return; } GameObject _go = objectToUpdate.WTBObject.GameObject; if (_go == null) { return; } _go.GetComponent <SyncWTBObject>().SendWTBSync(); //_go.GetPhotonView().RPC("RPCSendWTBSync", PhotonNetwork.masterClient, PhotonNetwork.player); }
public List <LuaWTBObject> PartsByNames(Table tableOfNames) { List <LuaWTBObject> partsList = new List <LuaWTBObject>(); foreach (WTBObject t in FindObjectsOfType <WTBObject>()) { foreach (DynValue nameDyn in tableOfNames.Values) { if (nameDyn.Type == DataType.String) { string name = nameDyn.String; LuaWTBObject lwtbo = Task.GetOrMakeLuaPart(t); if (lwtbo.name == name) { partsList.Add(Task.GetOrMakeLuaPart(t)); } } } } return(partsList); }
public void SetParent(LuaWTBObject @object, LuaWTBObject newParent) { @object.WTBObject.parent = newParent.WTBObject; @object.WTBObject.ComponentByName("Transform").PropertyByName("HasPhysics").Refresh(); }
public void CreateTalkBubble(LuaWTBObject @object, string message) { TalkController.instance.RecieveTalkMessageNonPlayer(message, @object.WTBObject.gameObject); }