Exemple #1
0
		public WeaponTargeting(IMyCubeBlock weapon)
			: base(weapon)
		{
			if (weapon == null)
				throw new ArgumentNullException("weapon");
			if (!(weapon is IMyTerminalBlock) || !(weapon is IMyFunctionalBlock) || !(weapon is IMyInventoryOwner) || !(weapon is Ingame.IMyUserControllableGun))
				throw new ArgumentException("weapon(" + weapon.DefinitionDisplayNameText + ") is not of correct type");

			this.myTurret = weapon as Ingame.IMyLargeTurretBase;
			this.myLogger = new Logger("WeaponTargeting", weapon);// { MinimumLevel = Logger.severity.DEBUG };

			this.Interpreter = new InterpreterWeapon(weapon);
			this.Options = new TargetingOptions();
			this.IsNormalTurret = myTurret != null;
			this.CubeBlock.OnClose += weapon_OnClose;
			this.value_defaultTargeting = IsNormalTurret;
			this.FuncBlock.AppendingCustomInfo += FuncBlock_AppendingCustomInfo;

			if (TPro_Shoot == null)
				TPro_Shoot = (weapon as IMyTerminalBlock).GetProperty("Shoot").AsBool();

			myLogger.debugLog("initialized", "WeaponTargeting()", Logger.severity.INFO);
		}
		public WeaponTargeting(IMyCubeBlock weapon)
			: base(weapon)
		{
			if (weapon == null)
				throw new ArgumentNullException("weapon");
			if (!(weapon is IMyTerminalBlock) || !(weapon is IMyFunctionalBlock) || !(weapon is IMyInventoryOwner) || !(weapon is Ingame.IMyUserControllableGun))
				throw new ArgumentException("weapon(" + weapon.DefinitionDisplayNameText + ") is not of correct type");

			this.myTurret = weapon as Ingame.IMyLargeTurretBase;
			this.myLogger = new Logger("WeaponTargeting", weapon) { MinimumLevel = Logger.severity.TRACE };

			this.Interpreter = new InterpreterWeapon(weapon);
			this.Options = new TargetingOptions();
			this.IsNormalTurret = myTurret != null;
			this.CubeBlock.OnClose += weapon_OnClose;

			if (TPro_Shoot == null)
				TPro_Shoot = (weapon as IMyTerminalBlock).GetProperty("Shoot").AsBool();
		}