예제 #1
0
        private bool IsPlayerNearby()
        {
            BoundingBox playerBox = new BoundingBox(Vector3.MaxValue, Vector3.MinValue);

            MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, MyNeutralShipSpawner.NEUTRAL_SHIP_FORBIDDEN_RADIUS);

            if (playerBox.Contains(ShipController.PositionComp.GetPosition()) == ContainmentType.Contains)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        public override void Update()
        {
            if (ShipController == null)
            {
                return;
            }

            if ((ShipController.PositionComp.GetPosition() - m_destination).Dot(m_direction) > 0.0f)
            {
                BoundingBox playerBox = new BoundingBox(Vector3.MaxValue, Vector3.MinValue);
                MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, MyNeutralShipSpawner.NEUTRAL_SHIP_FORBIDDEN_RADIUS);

                if (playerBox.Contains(ShipController.PositionComp.GetPosition()) != ContainmentType.Contains)
                {
                    var shipGroup = MyCubeGridGroups.Static.Logical.GetGroup(ShipController.CubeGrid);
                    foreach (var node in shipGroup.Nodes)
                    {
                        node.NodeData.SyncObject.SendCloseRequest();
                    }
                }
            }
        }
예제 #3
0
 void IMyEntities.GetInflatedPlayerBoundingBox(ref VRageMath.BoundingBox playerBox, float inflation)
 {
     MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, inflation);
 }