示例#1
0
 private static void RequierArg <T>(W_Type[] source, int index) where T : W_Type
 {
     if (index >= source.Length)
     {
         throw new Exception("Missing arguments");
     }
     if (!(source[index] is T))
     {
         source[index].Error("Expected argument of type {0} instead saw {1}", W_Type.GetName <T>(), source[index].TypeName);
     }
 }
示例#2
0
 private static void RequireIntArg(W_Type[] source, int index)
 {
     if (index >= source.Length)
     {
         throw new Exception("Missing arguments");
     }
     if (!(source[index] is W_Number))
     {
         source[index].Error("Expected argument of type {0} instead saw {1}", W_Type.GetName <W_Number>(), source[index].TypeName);
     }
     if (Math.Floor(source[index].Number) != source[index].Number)
     {
         source[index].Error("Expected a number with no decimal places");
     }
 }
示例#3
0
 public GameObject HasWeapon(W_Type type)
 {
     foreach (GameObject weapon in equipedWeapons)
     {
         if (!weapon || !weapon.GetComponent <WeaponNew> ())
         {
             continue;
         }
         else if (weapon.GetComponent <WeaponNew> ().weaponType == type)
         {
             return(weapon);
         }
     }
     return(null);
 }