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); } }
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"); } }
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); }