public static bool UpdateSmallDebrisScript(MySmallDebris smallDebris) { if (smallDebris.ModelLod0.ModelEnum == MyModelsEnum.cistern) { if (m_outpostReached == true && m_primaryTargetTextAlreadyAdded == false) { bool containsHud = MyHud.ContainsTextForEntity(smallDebris); if (containsHud == false) { MyHud.AddText(smallDebris, new StringBuilder("Primary target"), Color.Green); } } if (smallDebris.IsDestroyed()) { MyHud.RemoveText(smallDebris); // small ship explosion! MyExplosion explosion = MyExplosions.AddExplosion(); Vector3 explosionPosition = smallDebris.GetPosition(); if (explosion != null) { explosion.Start( MyExplosionTypeEnum.SMALL_SHIP_EXPLOSION, new BoundingSphere(explosionPosition, MyMwcUtils.GetRandomFloat(MyExplosionsConstants.EXPLOSION_RANDOM_RADIUS_MIN, MyExplosionsConstants.EXPLOSION_RANDOM_RADIUS_MAX)), MyExplosionsConstants.EXPLOSION_LIFESPAN); } smallDebris.Close(); m_remainingPrimaryTargetsCounter--; return(false); } } return(true); }
public static bool UpdateInfluenceSphereSoundScript(MyInfluenceSphereSound influenceSphereSound) { if ((m_remainingPrimaryTargetsCounter == 0) && (MyHud.ContainsTextForEntity(influenceSphereSound) == false)) { MyHud.AddText(influenceSphereSound, new StringBuilder("Russian Drop Zone"), Color.Green); } return(true); }
public void SetLocationVisibility(bool visible, MyEntity entity, MyGuitargetMode guiTargetMode) { if (visible) { MyHud.RemoveText(entity); MyHud.AddText(entity, HudNameTemp ?? NameTemp, guiTargetMode); } else { entity.UpdateHudMarker(true); } }
public virtual void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner, StringBuilder displayName = null) { System.Diagnostics.Debug.Assert(Closed); Closed = false; GuidedInMultiplayer = false; if (this.EntityId.HasValue) { MyEntityIdentifier.RemoveEntity(this.EntityId.Value); this.EntityId = null; } if (this.NeedsId) { //if(owner.EntityId.HasValue) this.EntityId = MyEntityIdentifier.AllocateId(owner.EntityId.Value.PlayerId); //else this.EntityId = MyEntityIdentifier.AllocateId(); this.EntityId = MyEntityIdentifier.AllocateId(); MyEntityIdentifier.AddEntityWithId(this); } if (displayName != null && owner == MySession.PlayerShip) { DisplayName = displayName.ToString(); MyHud.AddText(this, displayName, maxDistance: 1000); } m_isExploded = false; m_cascadeExplosionLevel = 0; m_origin = position; m_previousPosition = position; m_initialVelocity = initialVelocity; System.Diagnostics.Debug.Assert(owner.EntityId.HasValue, "Shooting entity must have ID"); m_ownerEntityID = owner.EntityId.Value; m_elapsedMiliseconds = 0; Matrix ammoWorld = Matrix.CreateWorld(position, direction, owner.WorldMatrix.Up); SetWorldMatrix(ammoWorld); this.Physics.Clear(); this.Physics.Enabled = true; this.Physics.LinearVelocity = initialVelocity; if (owner.Physics != null) { this.Physics.GroupMask = owner.Physics.GroupMask; } else { this.Physics.GroupMask = MyGroupMask.Empty; } //this.Physics.Enabled = true; this.Physics.ApplyImpulse(direction * this.Physics.Mass * impulseMultiplier, position); MyEntities.Add(this); NeedsUpdate = true; }