示例#1
0
        public static bool TryParse(string c, out DevCommand command)
        {
            Match m = REGEX.Match(c);

            if (m.Success)
            {
                string[]        split = Regex.Split(m.Groups[1].Value, RegexHelper.NUM_SPLIT);
                DevCommandSpawn comm  = new DevCommandSpawn();
                comm.TeamIndex = int.Parse(split[0]);
                comm.UnitIndex = int.Parse(split[1]);
                comm.Count     = int.Parse(split[2]);
                comm.X         = float.Parse(split[3]);
                comm.Z         = float.Parse(split[4]);
                command        = comm;
                return(true);
            }
            command = null;
            return(false);
        }
 private void ApplyLogic(GameState s, float dt, DevCommandSpawn c)
 {
     // Multiple Spawn Events
     SpawnUnitEvent e = new SpawnUnitEvent(c.TeamIndex, c.UnitIndex, new Vector2(c.X, c.Z));
     for(int i = 0; i < c.Count; i++) ApplyInput(s, dt, e);
 }
示例#3
0
 public static bool TryParse(string c, out DevCommand command)
 {
     Match m = REGEX.Match(c);
     if(m.Success) {
         string[] split = Regex.Split(m.Groups[1].Value, RegexHelper.NUM_SPLIT);
         DevCommandSpawn comm = new DevCommandSpawn();
         comm.TeamIndex = int.Parse(split[0]);
         comm.UnitIndex = int.Parse(split[1]);
         comm.Count = int.Parse(split[2]);
         comm.X = float.Parse(split[3]);
         comm.Z = float.Parse(split[4]);
         command = comm;
         return true;
     }
     command = null;
     return false;
 }