示例#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;
        }
    }
示例#2
0
 public ActivationInfo(ToolSlot slot, ToolType type, bool state, string propertyName, float propertyValue)
 {
     Slot = slot;
     State = state;
     Type = type;
     PropertyName = propertyName;
     PropertyValue = propertyValue;
 }
示例#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);
            }
        }
示例#4
0
文件: Player.cs 项目: hortont424/sand
 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();
     }
 }
示例#5
0
 public void OnToolUse(ToolSlot toolSlot)
 {
     ToolUse?.Invoke(toolSlot);
 }