protected override void OnDieObjectCreate( MapObjectCreateObject createObject, object objectCreated ) { base.OnDieObjectCreate( createObject, objectCreated ); MapObjectCreateMapObject createMapObject = createObject as MapObjectCreateMapObject; if( createMapObject != null ) { MapObject mapObject = (MapObject)objectCreated; //Corpse copy forceMaterial to meshes if( mapObject is Corpse && InitialFaction != null ) { bool badFaction = InitialFaction.Name == "BadFaction"; if( Type.Name == "RTSRobot" ) { ( mapObject.AttachedObjects[ 0 ] as MapObjectAttachedMesh ).MeshObject. SubObjects[ 0 ].MaterialName = badFaction ? "Robot2" : "Robot"; } else if( Type.Name == "RTSConstructor" ) { ( mapObject.AttachedObjects[ 0 ] as MapObjectAttachedMesh ).MeshObject. SubObjects[ 0 ].MaterialName = badFaction ? "Red" : "Blue"; } } } }
protected override void OnDieObjectCreate(MapObjectCreateObject createObject, object objectCreated) { base.OnDieObjectCreate(createObject, objectCreated); MapObjectCreateMapObject createMapObject = createObject as MapObjectCreateMapObject; if (createMapObject != null) { MapObject mapObject = (MapObject)objectCreated; //Corpse copy forceMaterial to meshes if (mapObject is Corpse && InitialFaction != null) { bool badFaction = InitialFaction.Name == "BadFaction"; if (Type.Name == "RTSRobot") { (mapObject.AttachedObjects[0] as MapObjectAttachedMesh).MeshObject. SubObjects[0].MaterialName = badFaction ? "Robot2" : "Robot"; } else if (Type.Name == "RTSConstructor") { (mapObject.AttachedObjects[0] as MapObjectAttachedMesh).MeshObject. SubObjects[0].MaterialName = badFaction ? "Red" : "Blue"; } } } }
protected override void OnDieObjectCreate(MapObjectCreateObject createObject, object objectCreated) { base.OnDieObjectCreate(createObject, objectCreated); MapObjectCreateMapObject createMapObject = createObject as MapObjectCreateMapObject; if (createMapObject != null) { MapObject mapObject = (MapObject)objectCreated; Explosion explosion = mapObject as Explosion; if (explosion != null) { explosion.DamageCoefficient = DamageCoefficient; explosion.SourceUnit = SourceUnit; } } }
protected override void OnDieObjectCreate( MapObjectCreateObject createObject, object objectCreated) { base.OnDieObjectCreate( createObject, objectCreated ); MapObjectCreateMapObject createMapObject = createObject as MapObjectCreateMapObject; if( createMapObject != null ) { MapObject mapObject = (MapObject)objectCreated; //Copy information to dead object //if( Type.Name + "Dead" == mapObject.Type.Name ) if( createMapObject.CopyVelocitiesFromParent ) { Dynamic dynamic = mapObject as Dynamic; if( dynamic != null ) CopyInfluencesToObject( dynamic ); } //random rotation if( createMapObject.Alias == "randomRotation" ) { Bullet bullet = mapObject as Bullet; if( bullet != null ) { bullet.Rotation = new Angles( World.Instance.Random.NextFloat() * 180.0f, World.Instance.Random.NextFloat() * 180.0f, World.Instance.Random.NextFloat() * 180.0f ).ToQuat(); bullet.Velocity = bullet.Rotation.GetForward() * bullet.Type.Velocity; } } } }
protected override void OnDieObjectCreate( MapObjectCreateObject createObject, object objectCreated ) { base.OnDieObjectCreate( createObject, objectCreated ); MapObjectCreateMapObject createMapObject = createObject as MapObjectCreateMapObject; if( createMapObject != null ) { MapObject mapObject = (MapObject)objectCreated; Explosion explosion = mapObject as Explosion; if( explosion != null ) { explosion.DamageCoefficient = DamageCoefficient; explosion.SourceUnit = SourceUnit; } } }