예제 #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
파일: Messages.cs 프로젝트: hortont424/sand
 public ActivationInfo(ToolSlot slot, ToolType type, bool state, string propertyName, float propertyValue)
 {
     Slot = slot;
     State = state;
     Type = type;
     PropertyName = propertyName;
     PropertyValue = propertyValue;
 }
예제 #3
0
파일: Messages.cs 프로젝트: hortont424/sand
        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);
 }