internal override void Update(MySmallShipBot bot) { base.Update(bot); MyEntity enemy = bot.GetEnemy(); MyDrillBase drill = bot.Weapons.GetMountedDrill(); if (enemy != null && drill != null) { Vector3 botToEnemy = enemy.GetPosition() - bot.GetPosition(); float distance = botToEnemy.Length(); if (distance <= (bot.DrillDistance + bot.WorldVolume.Radius + enemy.WorldVolume.Radius)) { if (drill.CurrentState == MyDrillStateEnum.InsideShip) { drill.Eject(); } else { drill.Shot(null); } } else { // pull drill back if (drill.CurrentState == MyDrillStateEnum.Activated) { drill.Eject(); } } bot.Move(enemy.GetPosition(), enemy.GetPosition(), enemy.WorldMatrix.Up, distance < 100); } }
/// <summary> /// Shots from drill /// </summary> public void FireDrill() { var harvester = GetMountedHarvestingDevice(); if (harvester != null && harvester.IsHarvesterActive) { return; } MyDrillBase drill = GetMountedDrill(); if (drill != null) { this.m_ship.InitGroupMaskIfNeeded(); drill.Eject(); } }