Esempio n. 1
0
    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]);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    public static GameObject Spawn(TempEffects id)
    {
        var prefab = Get(id);

        if (prefab == null)
        {
            return(null);
        }

        var spawned = Pool.Get(prefab.PoolableObject);

        return(spawned);
    }
Esempio n. 4
0
    /// <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);
    }
Esempio n. 5
0
 public static bool IsEffectLoaded(TempEffects ID)
 {
     return(loaded != null && loaded.ContainsKey(ID));
 }
Esempio n. 6
0
    public void RpcSpawnTempEffect(byte effect, Vector2 position, float angle)
    {
        TempEffects e = (TempEffects)effect;

        TempEffect.NetCallback(e, position, angle);
    }