public AttackType()
        {
            waveSprite     = new Animation();
            recoverSprite  = new Animation();
            spreaderSprite = new Animation();
            heaterSprite   = new Animation();
            bubblerSprite  = new Animation();

            onAction = (ParamsAction) delegate(object[] args) { };
        }
Exemple #2
0
 public void RegisterCommand(BaseUnityPlugin owner, string command, ParamsAction action)
 {
     command = command.ToLower();
     if (owners.ContainsKey(command))
     {
         Logger.LogError($"{command} already registered");
         return;
     }
     owners[command]         = owner;
     customCommands[command] = action;
     Logger.LogInfo($"Registering Command: {command}");
 }
Exemple #3
0
 //Any object can listen to an event any other object receives by design.
 public void RegisterListener(string name, ParamsAction action)
 {
     if (listeners.ContainsKey(name))
     {
         listeners[name].Add(action);
     }
     else
     {
         listeners.Add(name, new List <ParamsAction>()
         {
             action
         });
     }
 }
Exemple #4
0
 public static void AddCommand
     (string[] commandStrings, ParamsAction commandMethod, int reservedArguments = 0, bool fullMatch = false)
 {
     for (int i = 0; i < commandStrings.Length; i++)
     {
         if (commandDict.TryAdd(commandStrings[i].ToLower(), new Command(commandMethod, reservedArguments)))
         {
             Log.Debug("Added command \"{0}\" for {1} from {2} with {3} arguments.",
                       commandStrings[i].ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments);
         }
         else
         {
             Log.Debug("Failed to add command \"{0}\" for {1} from {2} with {3} arguments.",
                       commandStrings[i].ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments);
         }
     }
 }
Exemple #5
0
        public static bool AddCommand
            (string commandString, ParamsAction commandMethod, int reservedArguments = 0, bool fullMatch = false)
        {
            bool ret;

            if (ret = commandDict.TryAdd(commandString.ToLower(), new Command(commandMethod, reservedArguments, fullMatch)))
            {
                Log.Debug("Added command \"{0}\" for {1} from {2} with {3} arguments.",
                          commandString.ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments);
            }
            else
            {
                Log.Debug("Failed to add command \"{0}\" for {1} from {2} with {3} arguments.",
                          commandString.ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments);
            }
            return(ret);
        }
Exemple #6
0
        public T ParamsActionFunction <T>(ParamsAction <T> f)
        {
            T result = f();

            return(result);
        }
Exemple #7
0
 public static ParamsAction <B> FixParam <A, B>(this  A a, ParamsAction <A, B> f)
 {
     return(FixParam(f, a));
 }
Exemple #8
0
 public static ParamsAction <B> FixParam <A, B>(this ParamsAction <A, B> f, A a)
 {
     return(b => f(a, b));
 }