This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Receiving a single emote from a player. | |
public const short EmoteSingleReceiver = MsgType.Highest + 5; | |
/// Send emote and playerID of emote sender to each client. | |
public const short EmoteSingleSender = MsgType.Highest + 6; | |
/// Send Resource update from client to server. | |
public const short ResourceUpdate = MsgType.Highest + 7; | |
/// Send Send and receive a player flag request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Resource brick generator. | |
/// Randomly generates resources and adds them to the brickstructure[]. | |
public void resourceBrickGenerator() | |
{ | |
for (int i = 0; i < 100; i++) | |
{ | |
Vector3 pos = new Vector3 ((int) UnityEngine.Random.Range (0f, 100.0f) + 0.5f, Math.Max ((int) (UnityEngine.Random.Range (0f, 12.0f)), (int) WorldManager.minLevelHeight), (int) UnityEngine.Random.Range (0f, 100.0f) + 0.5f); | |
int blockHeight = (int) (pos.y - WorldManager.minLevelHeight); | |
levelStructure.setBlock(pos.x + 0.5f, pos.z + 0.5f, blockHeight, 5, -1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Send all clients an emote | |
void sendAllClientEmote(NetworkInstanceId netId, int emote) | |
{ | |
foreach(KeyValuePair<int, ClientDetails> entry in playerMonitoring) | |
{ | |
SendEmoteMessageAndClientID m = new SendEmoteMessageAndClientID (); | |
m.emoteType = emote; | |
m.netId = netId; | |
NetworkServer.SendToClient (entry.Key, LevelMsgType.EmoteSingleSender, m); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case LevelMsgType.EmoteSingleSender: | |
/// Receiving a single emote from a player. | |
{ | |
SendEmoteMessageAndClientID m = netMsg.ReadMessage<SendEmoteMessageAndClientID> (); | |
sendAllClientEmote(m.netId, m.emoteType); | |
Debug.Log ("Emote Received from Client."); | |
} | |
break; | |
case LevelMsgType.ResourceUpdate: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// The message sent when the player is updating the level. | |
class BlockAddMessage : MessageBase | |
{ | |
public float px; | |
public float pz; | |
public float height; | |
public int blocktype; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetworkClient.allClients[0].RegisterHandler (LevelMsgType.EmoteSingleSender, ServerCommandHandler); // Handle incoming emotes from server | |
NetworkClient.allClients[0].RegisterHandler (LevelMsgType.PlayerFlagRequest, ServerCommandHandler); | |
case LevelMsgType.EmoteSingleSender: | |
/// Handle incoming emotes from server | |
{ | |
SendEmoteMessageAndClientID m = netMsg.ReadMessage<SendEmoteMessageAndClientID> (); | |
displayEmote(m.emoteType, m.netId); | |
Debug.Log ("Incoming emote to client from server from network id: " + m.netId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ButtonAction() | |
{ | |
buttons[CurMenuItem].sceneimage.color = buttons[CurMenuItem].PressedColor; | |
GameObject Player = this.transform.parent.gameObject; | |
NetworkInstanceId netID = Player.GetComponent<NetworkIdentity>().netId; | |
Debug.Log ("Sending emote with networkID: " + netID.ToString()); | |
Vector3 offset = new Vector3(0.0f, 2.5f, 0.0f); | |
//IconObject DisplayEmote; | |
if (CurMenuItem == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(menuon == true) | |
{ | |
setUIToFalse = false; | |
PCamera = this.transform.parent.gameObject; | |
netIDC = PCamera.GetComponent<NetworkIdentity>().netId; | |
PCamera = ClientScene.FindLocalObject(netIDC); | |
pmove = PCamera.GetComponent<PlayerMove>(); | |
pmove.SetUIOpenTrue(); | |
} | |
else if (setUIToFalse == false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Networking; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System; | |
public class PlayerAnimator : NetworkBehaviour { | |
public Animator anim; | |
public float speed = 2.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool setUIToFalse = true; | |
public void SetUIOpenTrue() | |
{ | |
UIOpen = true; | |
} | |
public void SetUIOpenFalse() | |
{ | |
UIOpen = false; |