public void GetBytes(Contact.Bytes bytes, Vector POV = null) { //if POV is null, we send this rect as part of a model; otherwise, we send it to print on the screen bytes.Add(POV == null ? position : position - POV); bytes.Add(size); bytes.Add(texture); bytes.Add(angle); }
public void GetBytes(Contact.Bytes bytes) { Universe.Screen screen = new Universe.Screen(null); foreach (IShape shape in shapes) { screen.Add(shape); } screen.GetBytes(bytes); }
public void GetBytes(Contact.Bytes b, Vector POV) { if (Math.Abs(position.x - POV.x) > Constants.ScreenSize.x / 2 + Model.Models[modelID].BoundRadius || Math.Abs(position.y - POV.y) > Constants.ScreenSize.y / 2 + Model.Models[modelID].BoundRadius) { return; } b.Add(Model.order[modelID]); b.Add(position - POV); b.Add(angle); }
public void GetBytes(Contact.Bytes bytes, Vector POV) { if (Math.Abs(position.x - POV.x) > Constants.ScreenSize.x / 2 || Math.Abs(position.y - POV.y) > Constants.ScreenSize.y / 2) { return; } bytes.Add(text); bytes.Add(position - POV); bytes.Add(fontSize); bytes.Add(color); }
public static Contact.Bytes GetModelsBytes() { if (modelsBytes == null) { modelsBytes = new Contact.Bytes(); foreach (KeyValuePair <string, Model> kvp in Models) { kvp.Value.GetBytes(modelsBytes); } } return(modelsBytes); }
public void UpdatePlayer(string player, Contact.Bytes bytes) { players[player].AgentState.lookDirection = bytes.NextVector().Normal; var values = Enum.GetValues(typeof(Mouse)); foreach (var mc in values) { if (bytes.NextInt() == 1) players[player].AgentState.MouseDown((Mouse)mc); else players[player].AgentState.MouseUp((Mouse)mc); } for (int t = bytes.NextInt(); t != -1; t = bytes.NextInt()) players[player].AgentState.KeyDown((char)t); while (bytes.Count > 0) players[player].AgentState.KeyUp((char)bytes.NextInt()); }