本文整理汇总了C#中MinerWars.AppCode.Game.Entities.EntityDetector.MyEntityDetector.Init方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntityDetector.Init方法的具体用法?C# MyEntityDetector.Init怎么用?C# MyEntityDetector.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MinerWars.AppCode.Game.Entities.EntityDetector.MyEntityDetector
的用法示例。
在下文中一共展示了MyEntityDetector.Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitShipDetector
private void InitShipDetector()
{
//MyDetectingCriteria detectingCriteria = new MyDetectingCriteria();
//detectingCriteria.DetectingCriteria.Add(
//new MyDetectingCriterium(
// MyDetectedEntityAction.TradeForFree,
// new MyDetectingCondition<MyEntity>(
// //x => (MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Friend) && (x is MySmallShip || x is MyPrefabHangar || x is MyFoundationFactory) && ((IMyInventory)x).Inventory != null,
// x => (MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Friend) && (x is MySmallShip || x is MyPrefabHangar) && ((IMyInventory)x).Inventory != null,
// MySmallShipConstants.DETECT_SHIP_RADIUS)));
//detectingCriteria.DetectingCriteria.Add(
// new MyDetectingCriterium(
// MyDetectedEntityAction.TradeForMoney,
// new MyDetectingCondition<MyEntity>(
// x => (MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Neutral) && (x is MySmallShip || x is MyPrefabHangar) && !x.IsCripple() && ((IMyInventory)x).Inventory != null,
// MySmallShipConstants.DETECT_SHIP_RADIUS)));
//detectingCriteria.DetectingCriteria.Add(
// new MyDetectingCriterium(
// MyDetectedEntityAction.Steal,
// new MyDetectingCondition<MyEntity>(
// x => (MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Enemy || MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Neutral) && x.IsCripple() && x is MySmallShip,
// MySmallShipConstants.DETECT_SHIP_RADIUS)));
//detectingCriteria.DetectingCriteria.Add(
// new MyDetectingCriterium(
// MyDetectedEntityAction.Build,
// //new MyDetectingCondition<MyFoundationFactory>(
// // x => true,
// new MyDetectingCondition<MyPrefabContainer>(
// x => (MyFactions.GetFactionsRelation(this.Faction, x.Faction) == MyFactionRelationEnum.Friend) && x.ContainsPrefab(PrefabTypesFlagEnum.FoundationFactory),
// MySmallShipConstants.DETECT_FOUNDATION_FACTORY_RADIUS)));
//ShipDetector = new MyShipDetector(this, detectingCriteria);
List<IMyEntityDetectorCriterium> tradeCriterias = new List<IMyEntityDetectorCriterium>()
{
new MyEntityDetectorCriterium<MyEntity>((int)MySmallShipInteractionActionEnum.TradeForFree,
MySmallShipInteraction.CanTradeForFree, true, this),
new MyEntityDetectorCriterium<MyEntity>((int)MySmallShipInteractionActionEnum.TradeForMoney,
MySmallShipInteraction.CanTrade, true, this),
new MyEntityDetectorCriterium<MySmallShip>((int)MySmallShipInteractionActionEnum.Loot,
MySmallShipInteraction.CanLootShip, true, this),
new MyEntityDetectorCriterium<MyCargoBox>((int)MySmallShipInteractionActionEnum.Examine,
MySmallShipInteraction.CanExamineCargoBox, true, this),
new MyEntityDetectorCriterium<MyCargoBox>((int)MySmallShipInteractionActionEnum.ExamineEmpty,
MySmallShipInteraction.CanExamineEmptyCargoBox, true, this),
new MyEntityDetectorCriterium<MyEntity>((int)MySmallShipInteractionActionEnum.Blocked,
MySmallShipInteraction.IsBlocked, true, this),
};
List<IMyEntityDetectorCriterium> buildCriterias = new List<IMyEntityDetectorCriterium>()
{
new MyEntityDetectorCriterium<MyPrefabContainer>((int) MySmallShipInteractionActionEnum.Build,
MySmallShipInteraction.CanBuild, this)
};
List<IMyEntityDetectorCriterium> motherShipCriterias = new List<IMyEntityDetectorCriterium>()
{
new MyEntityDetectorCriterium<MyPrefabHangar>(1, MySmallShipInteraction.IsNearMothership, true, this)
};
List<IMyEntityDetectorCriterium> useableEntityCriterias = new List<IMyEntityDetectorCriterium>()
{
new MyEntityDetectorCriterium<MyEntity>((int)MySmallShipInteractionActionEnum.Use,
MySmallShipInteraction.CanUse, true, this),
new MyEntityDetectorCriterium<MyEntity>((int)MySmallShipInteractionActionEnum.Hack,
MySmallShipInteraction.CanHack, true, this),
};
TradeDetector = new MyEntityDetector();
TradeDetector.Init(null, new MyMwcObjectBuilder_EntityDetector(new Vector3(MySmallShipConstants.DETECT_SHIP_RADIUS * 2f, 0f, 0f), MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere), this, WorldMatrix, tradeCriterias);
TradeDetector.OnNearestEntityChange += OnNearestDetectedEntityChanged;
TradeDetector.OnNearestEntityCriteriasChange += OnNearestDetectedEntityCriteriasChanged;
BuildDetector = new MyEntityDetector();
BuildDetector.Init(null, new MyMwcObjectBuilder_EntityDetector(new Vector3(MySmallShipConstants.DETECT_FOUNDATION_FACTORY_RADIUS * 2f, 0f, 0f), MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere), this, WorldMatrix, buildCriterias);
BuildDetector.OnNearestEntityChange += OnNearestDetectedEntityChanged;
BuildDetector.OnNearestEntityCriteriasChange += OnNearestDetectedEntityCriteriasChanged;
MotherShipDetector = new MyEntityDetector();
MotherShipDetector.Init(null, new MyMwcObjectBuilder_EntityDetector(new Vector3(MySmallShipConstants.DETECT_SHIP_RADIUS * 2f, 0f, 0f), MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere), this, WorldMatrix, motherShipCriterias);
MotherShipDetector.OnNearestEntityChange += OnNearestDetectedEntityChanged;
MotherShipDetector.OnNearestEntityCriteriasChange += OnNearestDetectedEntityCriteriasChanged;
UseableEntityDetector = new MyEntityDetector();
UseableEntityDetector.Init(null, new MyMwcObjectBuilder_EntityDetector(new Vector3(MySmallShipConstants.DETECT_SHIP_RADIUS * 2f, 0f, 0f), MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere), this, WorldMatrix, useableEntityCriterias);
UseableEntityDetector.OnNearestEntityChange += OnNearestDetectedEntityChanged;
UseableEntityDetector.OnNearestEntityCriteriasChange += OnNearestDetectedEntityCriteriasChanged;
}
示例2: CreateDetectorForParticleEffect
void CreateDetectorForParticleEffect()
{
m_smallShipDetector = new MyEntityDetector();
m_smallShipDetector.Init(
null,
new MyMwcObjectBuilder_EntityDetector(
new Vector3(MyDummyPointConstants.PARTICLE_DETECTOR_SIZE * UserScale, 0, 0),
MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere),
this,
WorldMatrix,
new List<IMyEntityDetectorCriterium>());
m_smallShipDetector.Save = false;
m_smallShipDetector.SetSensorDetectRigidBodyTypes(MyConstants.RIGIDBODY_TYPE_SHIP);
m_smallShipDetector.On();
}