/// <summary> /// Removes Net data, and destroys object /// </summary> /// <param name="netId"></param> public static void DestroyNetGameObject(long netId) { GameObjectData goData_C0; if (singleton._netIdToGameObjectData.TryGetValue(netId, out goData_C0)) { GameObjectData goData_C1; if (singleton._netIdToGameObjectData.TryGetValue(goData_C0.gameObjectInstanceId, out goData_C1)) { if (goData_C0.Equals(goData_C1) == false) // should be the same { Debug.LogError("ERROR, GameObjectData is messed up!"); } // if we own the object, we can destroy it accross call clients if (FFSystem.OwnGameObject(goData_C0.gameObject)) { //Debug.Log("Sent NetObjectDestroyedEvent");//debug NetObjectDestroyedEvent e; e.destructiontime = FFSystem.time; e.gameObjectNetId = goData_C1.gameObjectNetId; FFMessage <NetObjectDestroyedEvent> .SendToNet(e, true); } singleton._netIdToGameObjectData.Remove(goData_C1.gameObjectNetId); singleton._localIdToGameObjectData.Remove(goData_C1.gameObjectInstanceId); } } }
void Start() { if (FFSystem.OwnGameObject(gameObject)) { FFMessage <ChangeLevelStateEvent> .Connect(OnChangeLevelStateEvent); } }
public static bool isOwnedNetObject(this GameObject _go) { return(FFSystem.OwnGameObject(_go)); }