public void SetTargetCube(Vector3I blockPosition, long entityId) { TargetType = MyAiTargetEnum.CUBE; EntityId = entityId; TreeId = null; Position = new Vector3D(blockPosition); }
public void SetTargetTree(Vector3D treePosition, long entityId, long treeId) { TargetType = MyAiTargetEnum.ENVIRONMENT_ITEM; EntityId = entityId; TreeId = treeId; Position = treePosition; }
public void SetTargetPosition(Vector3D position) { TargetType = MyAiTargetEnum.POSITION; EntityId = null; TreeId = null; Position = position; }
public void SetTargetEntity(MyAiTargetEnum targetType, long entityId) { TargetType = targetType; EntityId = entityId; TreeId = null; Position = null; }
public MyBBMemoryTarget(Vector3D position, long environmentId, long itemId) { TargetType = MyAiTargetEnum.ENVIRONMENT_ITEM; EntityId = environmentId; TreeId = itemId; Position = position; }
public static void SetTargetEntity(ref MyBBMemoryTarget target, MyAiTargetEnum targetType, long entityId, Vector3D? position = null) { if (target == null) target = new MyBBMemoryTarget(); target.TargetType = targetType; target.EntityId = entityId; target.TreeId = null; target.Position = position; }
public MyAiTargetBase(IMyEntityBot bot) { m_user = bot; m_bot = bot as MyAgentBot; m_currentTarget = MyAiTargetEnum.NO_TARGET; MyAiTargetManager.AddAiTarget(this); }
public MyAiTargetBase(IMyEntityBot bot) { m_user = bot; m_bot = bot as MyAgentBot; m_currentTarget = MyAiTargetEnum.NO_TARGET; MyAiTargetManager.Static.AddAiTarget(this); }
public void SetTargetVoxel(Vector3D pos, MyVoxelMap voxelMap) { UnsetTarget(); MyVoxelCoordSystems.WorldPositionToVoxelCoord(voxelMap.PositionLeftBottomCorner, ref pos, out m_targetInVoxelCoord); SetMTargetPosition(pos); m_currentTarget = MyAiTargetEnum.VOXEL; }
public void SetTargetBlock(MySlimBlock slimBlock, ushort?compoundId = new ushort?()) { if (!ReferenceEquals(this.m_targetEntity, slimBlock.CubeGrid)) { this.SetTargetEntity(slimBlock.CubeGrid); } this.m_targetCube = slimBlock.Position; this.m_currentTarget = MyAiTargetEnum.CUBE; }
private void Clear() { this.m_currentTarget = MyAiTargetEnum.NO_TARGET; this.m_targetEntity = null; this.m_targetCube = Vector3I.Zero; this.m_targetPosition = Vector3D.Zero; this.m_targetInVoxelCoord = Vector3I.Zero; this.m_compoundId = null; this.m_targetTreeId = 0; }
protected virtual void UnsetTargetEntity() { if (this.IsTargetGridOrBlock(this.m_currentTarget) && (this.m_targetEntity is MyCubeGrid)) { (this.m_targetEntity as MyCubeGrid).OnBlockRemoved -= new Action <MySlimBlock>(this.BlockRemoved); } this.m_compoundId = null; this.m_targetEntity = null; this.m_currentTarget = MyAiTargetEnum.NO_TARGET; }
private void Clear() { m_currentTarget = MyAiTargetEnum.NO_TARGET; m_targetEntity = null; m_targetCube = Vector3I.Zero; m_targetPosition = Vector3D.Zero; m_targetInVoxelCoord = Vector3I.Zero; m_compoundId = null; m_targetTreeId = 0; }
public static void SetTargetEntity(ref MyBBMemoryTarget target, MyAiTargetEnum targetType, long entityId, Vector3D?position = null) { if (target == null) { target = new MyBBMemoryTarget(); } target.TargetType = targetType; target.EntityId = entityId; target.TreeId = null; target.Position = position; }
public void SetTargetBlock(MySlimBlock slimBlock, ushort?compoundId = null) { if (m_targetEntity != slimBlock.CubeGrid) { // We don't have to unset the target, because it will be done in SetTargetEntity SetTargetEntity(slimBlock.CubeGrid); } m_targetCube = slimBlock.Position; m_currentTarget = MyAiTargetEnum.CUBE; }
public void SetTargetBlock(MySlimBlock slimBlock, ushort?compoundId = null) { if (m_targetEntity != slimBlock.CubeGrid) { UnsetTarget(); SetTargetEntity(slimBlock.CubeGrid); } m_targetCube = slimBlock.Position; m_currentTarget = MyAiTargetEnum.CUBE; }
protected virtual void UnsetTargetEntity() { Debug.Assert(m_targetEntity != null); if (IsTargetGridOrBlock(m_currentTarget) && m_targetEntity is MyCubeGrid) { var grid = m_targetEntity as MyCubeGrid; grid.OnBlockRemoved -= BlockRemoved; } m_compoundId = null; m_targetEntity = null; m_currentTarget = MyAiTargetEnum.NO_TARGET; }
protected virtual void SetTargetEntity(MyEntity entity) { if (entity == null) { if (m_targetEntity != null) { UnsetTargetEntity(); } return; } if (entity is MyCubeBlock) { SetTargetBlock((entity as MyCubeBlock).SlimBlock); } else { UnsetTarget(); m_targetEntity = entity; if (entity is MyCubeGrid) { (entity as MyCubeGrid).OnBlockRemoved += BlockRemoved; m_currentTarget = MyAiTargetEnum.GRID; } else if (entity is MyCharacter) { m_currentTarget = MyAiTargetEnum.CHARACTER; } else if (entity is MyVoxelBase) { m_currentTarget = MyAiTargetEnum.VOXEL; } else if (entity is MyEntity) { m_currentTarget = MyAiTargetEnum.ENTITY; } } }
public virtual void Init(MyObjectBuilder_AiTarget builder) { m_currentTarget = builder.CurrentTarget; m_targetEntity = null; if (builder.EntityId.HasValue) { if (!MyEntities.TryGetEntityById(builder.EntityId.Value, out m_targetEntity)) { m_currentTarget = MyAiTargetEnum.NO_TARGET; } } else { m_currentTarget = MyAiTargetEnum.NO_TARGET; } m_targetCube = builder.TargetCube; m_targetPosition = builder.TargetPosition; m_compoundId = builder.CompoundId; if (builder.UnreachableEntities != null) { foreach (var data in builder.UnreachableEntities) { MyEntity entity = null; if (MyEntities.TryGetEntityById(data.UnreachableEntityId, out entity)) { m_unreachableEntities.Add(entity, MySandboxGame.TotalGamePlayTimeInMilliseconds + data.Timeout); } else { Debug.Assert(false, "Couldn't find entity with given id: " + data.UnreachableEntityId); } } } }
public void SetTargetPosition(Vector3D pos) { UnsetTarget(); SetMTargetPosition(pos); m_currentTarget = MyAiTargetEnum.POSITION; }
public void SetTargetBlock(MySlimBlock slimBlock, ushort? compoundId = null) { if (m_targetEntity != slimBlock.CubeGrid) { // We don't have to unset the target, because it will be done in SetTargetEntity SetTargetEntity(slimBlock.CubeGrid); } m_targetCube = slimBlock.Position; m_currentTarget = MyAiTargetEnum.CUBE; }
protected virtual void SetTargetEntity(MyEntity entity) { if (entity is MyCubeBlock) { SetTargetBlock((entity as MyCubeBlock).SlimBlock); } else { if (m_targetEntity != null) UnsetTargetEntity(); m_targetEntity = entity; if (entity is MyCubeGrid) { (entity as MyCubeGrid).OnBlockRemoved += BlockRemoved; m_currentTarget = MyAiTargetEnum.GRID; } else if (entity is MyCharacter) { m_currentTarget = MyAiTargetEnum.CHARACTER; } else if (entity is MyVoxelBase) { m_currentTarget = MyAiTargetEnum.VOXEL; } else if (entity is MyEnvironmentItems) { m_currentTarget = MyAiTargetEnum.ENVIRONMENT_ITEM; } else if (entity is MyEntity) { m_currentTarget = MyAiTargetEnum.ENTITY; } } }
public void SetTargetPosition(Vector3D position) { TargetType = MyAiTargetEnum.POSITION; EntityId = null; Position = position; }
public void SetTargetEntity(MyAiTargetEnum targetType, long entityId) { TargetType = targetType; EntityId = entityId; Position = null; }
public void SetTargetCube(Vector3I blockPosition, long entityId) { TargetType = MyAiTargetEnum.CUBE; EntityId = entityId; Position = new Vector3D(blockPosition); }
public MyAiTargetBase(IMyEntityBot bot) { m_user = bot; m_bot = bot as MyAgentBot; m_currentTarget = MyAiTargetEnum.NO_TARGET; }
public virtual void UnsetTarget() { m_currentTarget = MyAiTargetEnum.NO_TARGET; m_targetEntity = null; }
public void SetTargetBlock(MySlimBlock slimBlock, ushort? compoundId = null) { if (m_targetEntity != slimBlock.CubeGrid) { UnsetTarget(); SetTargetEntity(slimBlock.CubeGrid); } m_targetCube = slimBlock.Position; m_currentTarget = MyAiTargetEnum.CUBE; }
public MyBBMemoryTarget(MyAiTargetEnum targetType, long entityId) { SetTargetEntity(targetType, entityId); }
public bool IsTargetGridOrBlock(MyAiTargetEnum type) { return(type == MyAiTargetEnum.CUBE || type == MyAiTargetEnum.GRID); }
public void SetTargetPosition(Vector3D pos) { UnsetTarget(); m_targetPosition = pos; m_currentTarget = MyAiTargetEnum.POSITION; }
public bool IsTargetGridOrBlock(MyAiTargetEnum type) => ((type == MyAiTargetEnum.CUBE) || (type == MyAiTargetEnum.GRID));
public void SetTargetPosition(Vector3D pos) { this.UnsetTarget(); this.SetMTargetPosition(pos); this.m_currentTarget = MyAiTargetEnum.POSITION; }
public bool IsTargetGridOrBlock(MyAiTargetEnum type) { return type == MyAiTargetEnum.CUBE || type == MyAiTargetEnum.GRID; }
public virtual void Init(MyObjectBuilder_AiTarget builder) { m_currentTarget = builder.CurrentTarget; m_targetEntity = null; if (builder.EntityId.HasValue) { if (!MyEntities.TryGetEntityById(builder.EntityId.Value, out m_targetEntity)) { m_currentTarget = MyAiTargetEnum.NO_TARGET; } } else { m_currentTarget = MyAiTargetEnum.NO_TARGET; } m_targetCube = builder.TargetCube; SetMTargetPosition(builder.TargetPosition); m_compoundId = builder.CompoundId; if (builder.UnreachableEntities != null) { foreach (var data in builder.UnreachableEntities) { MyEntity entity = null; if (MyEntities.TryGetEntityById(data.UnreachableEntityId, out entity)) m_unreachableEntities.Add(entity, MySandboxGame.TotalGamePlayTimeInMilliseconds + data.Timeout); else Debug.Assert(false, "Couldn't find entity with given id: " + data.UnreachableEntityId); } } }