Пример #1
0
/// <summary>
///  Trigger particle system for provided object, positioned at its top parent.
///	 Parent is resolved on serverside, Position is calculated on clientside.
/// </summary>
/// <param name="gameObject">Object with ParticleSystem in hierarchy</param>
/// <param name="targetVector">AimApply interaction TargetVector (relative to gameObject)</param>
    public static void PlayParticleDirectional(GameObject gameObject, Vector2 targetVector)
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        PlayParticleMessage.SendToAll(gameObject, targetVector);
    }
Пример #2
0
    /// <summary>
    /// Tell all clients + server to play particle effect for provided gameObject
    /// </summary>
    public static PlayParticleMessage SendToAll(GameObject obj, Vector2 targetVector)
    {
        GameObject topContainer = null;

        try
        {
            topContainer = obj.GetComponent <PushPull>().TopContainer.gameObject;
        } catch (Exception ignored) {}           // TODO This should not be ignored!!


        PlayParticleMessage msg = new PlayParticleMessage {
            ParticleObject = obj.NetId(),
            ParentObject   = topContainer == null ? NetId.Invalid : topContainer.NetId(),
            UseAngle       = targetVector != Vector2.zero,
            Angle          = Orientation.AngleFromUp(targetVector),
        };

        msg.SendToAll();
        return(msg);
    }
Пример #3
0
    /// <summary>
    /// Tell all clients + server to play particle effect for provided gameObject
    /// </summary>
    public static PlayParticleMessage SendToAll(GameObject obj, Vector2 targetVector)
    {
        GameObject topContainer = null;

        try
        {
            topContainer = obj.GetComponent <PushPull>().TopContainer.gameObject;
        }
        catch (Exception ignored)
        {
            Debug.Log($"PlayParticleMessage threw an exception {ignored} which has been ignored.");
        }


        PlayParticleMessage msg = new PlayParticleMessage {
            ParticleObject = obj.NetId(),
            ParentObject   = topContainer == null ? NetId.Invalid : topContainer.NetId(),
            TargetVector   = targetVector,
        };

        msg.SendToAll();
        return(msg);
    }