public static TempEffect Get(TempEffects id) { if (!IsEffectLoaded(id)) { Debug.LogError("Effect {0} is not loaded; Are any effects loaded: {1}".Form(id, loaded != null)); return(null); } return(loaded[id]); }
public static void NetCallback(TempEffects id, Vector2 position, float angle) { var spawned = Spawn(id); if (spawned == null) { return; } spawned.transform.position = position; spawned.transform.eulerAngles = new Vector3(0f, 0f, angle); }
public static GameObject Spawn(TempEffects id) { var prefab = Get(id); if (prefab == null) { return(null); } var spawned = Pool.Get(prefab.PoolableObject); return(spawned); }
/// <summary> /// Server only! Spawns a temp effect across all clients and on the server. Does not use networked objects, /// so is quite efficient. Just one RPC, with around 16 bytes per call. /// </summary> /// <returns></returns> public static GameObject NetSpawn(TempEffects id, Vector2 position, float angle) { if (!NetworkServer.active) { return(null); } var spawned = Spawn(id); if (spawned == null) { return(null); } Spawnables.Instance.RpcSpawnTempEffect((byte)id, position, angle); spawned.transform.position = position; spawned.transform.eulerAngles = new Vector3(0f, 0f, angle); return(spawned); }
public static bool IsEffectLoaded(TempEffects ID) { return(loaded != null && loaded.ContainsKey(ID)); }
public void RpcSpawnTempEffect(byte effect, Vector2 position, float angle) { TempEffects e = (TempEffects)effect; TempEffect.NetCallback(e, position, angle); }