private void UseTool(ToolSlot toolSlot) { switch (toolSlot.tool.name) { case "Watering Pail": UseWateringPail(); return; case "Plow": UsePlow(); return; case "WateringPail": UseWateringPail(); return; case "Bow": // Handled externally return; default: Debug.Log("Unimplemented Tool Name [" + toolSlot.tool.name + "]"); return; } }
public ActivationInfo(ToolSlot slot, ToolType type, bool state, string propertyName, float propertyValue) { Slot = slot; State = state; Type = type; PropertyName = propertyName; PropertyValue = propertyValue; }
public static void SendActivateToolMessage(Player player, ToolSlot slot, ToolType type, bool newState, string propertyName, float propertyValue, byte id, bool immediate) { SendMessageHeader(MessageType.ActivateTool, id); Storage.PacketWriter.Write((byte)slot); Storage.PacketWriter.Write((byte)type); Storage.PacketWriter.Write(newState); Storage.PacketWriter.Write(propertyName ?? ""); Storage.PacketWriter.Write(propertyValue); if(immediate) { SendOneOffMessage(player); } }
public Tool ToolInSlot(ToolSlot slot, ToolType type) { switch(slot) { case ToolSlot.Primary: return PrimaryA.Type == type ? PrimaryA : PrimaryB; case ToolSlot.Weapon: return Weapon; case ToolSlot.Mobility: return Mobility; case ToolSlot.Utility: return Utility; default: throw new ArgumentOutOfRangeException(); } }
public void OnToolUse(ToolSlot toolSlot) { ToolUse?.Invoke(toolSlot); }