/// <summary> /// try to interact with this object /// </summary> public override bool TryInteract(vp_FPPlayerEventHandler player) { if (Platform == null) { return(false); } if (m_Player == null) { m_Player = player; } if (Time.time < m_Timeout) { return(false); } PlaySound(); Platform.SendMessage("GoTo", Platform.TargetedWaypoint == 0 ? 1 : 0, SendMessageOptions.DontRequireReceiver); m_Timeout = Time.time + SwitchTimeout; m_IsSwitched = !m_IsSwitched; return(true); }
/// <summary> /// try to press this platform switch. this will have effect /// in singleplayer, but only in multiplayer if we're the /// master / server. sounds will always play and timers will /// be maintained in case of a master client handover /// </summary> public override bool TryInteract(vp_PlayerEventHandler player) { if (Platform == null) { return(false); } if (m_Player == null) { m_Player = player; } if (Time.time < m_Timeout) { return(false); } PlaySound(); // only try to actually operate the platform if we're the master. // if we're just a client the master should detect the trigger enter // too, and should activate the platform remotely if (vp_Gameplay.IsMaster) { Platform.SendMessage("GoTo", Platform.TargetedWaypoint == 0 ? 1 : 0, SendMessageOptions.DontRequireReceiver); } else if (InteractType == vp_InteractType.Normal) { this.SendMessage("ClientTryInteract"); } m_Timeout = Time.time + SwitchTimeout; m_IsSwitched = !m_IsSwitched; return(true); }