Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 public ActivationInfo(ToolSlot slot, ToolType type, bool state, string propertyName, float propertyValue)
 {
     Slot = slot;
     State = state;
     Type = type;
     PropertyName = propertyName;
     PropertyValue = propertyValue;
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 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();
     }
 }
Exemplo n.º 5
0
 public void OnToolUse(ToolSlot toolSlot)
 {
     ToolUse?.Invoke(toolSlot);
 }