Пример #1
0
    public static DoorUpdateMessage SendToAll(GameObject door, DoorUpdateType type)
    {
        var msg = new DoorUpdateMessage {
            Door = door.NetId(),
            Type = type,
        };

        msg.SendToAll();
        return(msg);
    }
Пример #2
0
    /// <summary>
    /// Send update to one player
    /// </summary>
    /// <param name="recipient">gameobject of the player recieving it</param>
    /// <param name="door">door being updated</param>
    /// <param name="type">animation to play</param>
    /// <param name="skipAnimation">if true, all sound and animations will be skipped, leaving it in its end position.
    ///     Currently only used for when players are joining and there are open doors.</param>
    /// <returns></returns>
    public static DoorUpdateMessage Send(GameObject recipient, GameObject door, DoorUpdateType type, bool skipAnimation = false)
    {
        var msg = new DoorUpdateMessage {
            Door          = door.NetId(),
            Type          = type,
            SkipAnimation = skipAnimation
        };

        msg.SendTo(recipient);
        return(msg);
    }
Пример #3
0
        public static NetMessage SendToAll(GameObject door, DoorUpdateType type)
        {
            var msg = new NetMessage
            {
                Door          = door.NetId(),
                Type          = type,
                SkipAnimation = false
            };

            SendToAll(msg);
            return(msg);
        }
Пример #4
0
        /// <summary>
        /// Send update to one player
        /// </summary>
        /// <param name="recipient">gameobject of the player recieving it</param>
        /// <param name="door">door being updated</param>
        /// <param name="type">animation to play</param>
        /// <param name="skipAnimation">if true, all sound and animations will be skipped, leaving it in its end position.
        ///     Currently only used for when players are joining and there are open doors.</param>
        /// <returns></returns>
        public static NetMessage Send(NetworkConnection recipient, GameObject door, DoorUpdateType type, bool skipAnimation = false)
        {
            var msg = new NetMessage
            {
                Door          = door.NetId(),
                Type          = type,
                SkipAnimation = skipAnimation
            };

            SendTo(recipient, msg);
            return(msg);
        }
Пример #5
0
 public void SynchroniseLayerState(DoorUpdateType OldType, DoorUpdateType NewType)
 {
     DoorState = NewType;
     if (NewType == DoorUpdateType.Close)
     {
         UpdateLayerClosed();
     }
     else if (NewType == DoorUpdateType.Open)
     {
         UpdateLayerOpen();
     }
 }
Пример #6
0
    /// <summary>
    /// Play the specified animation
    /// </summary>
    /// <param name="type">animation to play</param>
    /// <param name="skipAnimation">if true, animation should be skipped to the end and no sound should be
    ///     played - currently only used for when players are joining and there are open doors to sync.</param>
    public void PlayAnimation(DoorUpdateType type, bool skipAnimation)
    {
        switch (type)
        {
        case DoorUpdateType.Open:
            OpenDoor(skipAnimation);
            break;

        case DoorUpdateType.Close:
            CloseDoor(skipAnimation);
            break;

        case DoorUpdateType.AccessDenied:
            AccessDenied(skipAnimation);
            break;
        }
    }
Пример #7
0
        //Called on client and server
        // panelExposed and lights not hooked up into the net message yet
        public void PlayAnimation(DoorUpdateType type, bool skipAnimation, bool panelExposed = false, bool lights = true)
        {
            if (type == DoorUpdateType.Open)
            {
                StartCoroutine(PlayOpeningAnimation(skipAnimation, panelExposed));
            }
            else if (type == DoorUpdateType.Close)
            {
                StartCoroutine(PlayClosingAnimation(skipAnimation, panelExposed));
            }
            else if (type == DoorUpdateType.AccessDenied)
            {
                StartCoroutine(PlayDeniedAnimation());
            }

            else if (type == DoorUpdateType.PressureWarn)
            {
                StartCoroutine(PlayPressureWarningAnimation());
            }
        }