public void CreateSceneProp(string scenePropKind, Mogre.Vector3 position) { SceneProp sceneProp = new SceneProp(gameObjects.Count, world, scenePropKind, position); if (!gameObjects.ContainsKey(scenePropKind)) { gameObjects.Add(scenePropKind, new List <GameObject>()); } gameObjects[scenePropKind].Add(sceneProp); }
/// <summary> /// Create a static scene prop /// </summary> /// <param name="scenePropTypeID"></param> /// <param name="position"></param> /// <returns></returns> public string CreateSceneProp(string scenePropTypeID, Mogre.Vector3 position) { var findSceneProp = modData.ScenePropInfos.Where(o => o.ID == scenePropTypeID).FirstOrDefault(); if (findSceneProp != null) { SceneProp sceneProp = new SceneProp(world, findSceneProp, position); if (findSceneProp.Combined) { foreach (var modelData in findSceneProp.Models) { var findModelType = modData.ModModelTypes.Where(o => o.Name == modelData.ModelType).FirstOrDefault(); if (findModelType != null) { var findedModel = modData.ModelInfos.Where(o => o.ID == modelData.ModelID).FirstOrDefault(); if (findedModel != null) { findedModel.ModelType = findModelType; sceneProp.AppendChildModelData(findedModel); } } } } else { var findModelType = modData.ModModelTypes.Where(o => o.Name == findSceneProp.Models[0].ModelType).FirstOrDefault(); if (findModelType != null) { var findedModel = modData.ModelInfos.Where(o => o.ID == findSceneProp.Models[0].ModelID).FirstOrDefault(); if (findedModel != null) { findedModel.ModelType = findModelType; sceneProp.AppendChildModelData(findedModel); } } } if (!gameObjects.ContainsKey(scenePropTypeID)) { gameObjects.Add(scenePropTypeID, new List <GameObject>()); } gameObjects[scenePropTypeID].Add(sceneProp); sceneProp.ID = gameObjects[scenePropTypeID].Count; sceneProp.Spawn(); return(sceneProp.ID.ToString()); } return(null); }
public void RemoveSceneProp(string propInstanceID) { SceneProp prop = GetSceneProp(propInstanceID); if (prop != null) { prop.Dispose(); for (int i = 0; i < gameObjects.Count; i++) { for (int j = gameObjects.ElementAt(i).Value.Count - 1; j >= 0; j--) { if (gameObjects.ElementAt(i).Value[j].ID == propInstanceID) { gameObjects.ElementAt(i).Value.RemoveAt(j); return; } } } } }
public bool CheckCondition(params object[] param) { string missileScenePropInstanceID = param[0].ToString(); string scenePropInstanceID = param[1].ToString(); GameMap map = param[2] as GameMap; SceneProp sceneProp = map.GetSceneProp(scenePropInstanceID); if (sceneProp == null) { return(false); } SceneProp missileSceneProp = map.GetSceneProp(missileScenePropInstanceID); if (missileSceneProp == null) { return(false); } return(sceneProp.CheckCollide(missileSceneProp)); }
/// <summary> /// Create a static scene prop /// </summary> /// <param name="scenePropID"></param> /// <param name="position"></param> /// <returns></returns> public string CreateSceneProp(string scenePropID, Mogre.Vector3 position) { var findSceneProps = modData.SceneProps.Where(o => o.ID == scenePropID); if (findSceneProps.Count() > 0) { var findSceneProp = findSceneProps.ElementAt(0); var findModelTypes = modData.ModModelTypes.Where(o => o.Name == findSceneProp.ModelType); if (findModelTypes.Count() > 0) { var findModelType = findModelTypes.ElementAt(0); object[] MeshMaterialArray = findModelType.Process(modData, findSceneProp.Model) as object[]; Item attachedItem = null; if (MeshMaterialArray.Length == 3) { attachedItem = MeshMaterialArray[2] as Item; } SceneProp sceneProp = new SceneProp( gameObjects.Count, world, findSceneProp.Name, MeshMaterialArray[0].ToString(), MeshMaterialArray[1].ToString(), position, null ); if (!gameObjects.ContainsKey(scenePropID)) { gameObjects.Add(scenePropID, new List <GameObject>()); } gameObjects[scenePropID].Add(sceneProp); string guidStr = Guid.NewGuid().ToString(); sceneProp.SetID(guidStr); return(guidStr); } } return(null); }
/// <summary> /// Move the specific scene prop with movement /// </summary> /// <param name="propInstanceID">Scene Prop ID</param> /// <param name="axis">Axis 0 - X, 1 - Y, 2 - Z</param> /// <param name="movement">movement</param> public void MoveSceneProp(string propInstanceID, int axis, int movement) { Mogre.Vector3 mov = new Mogre.Vector3(); switch (axis) { case 0: //X Axis mov.x = movement; break; case 1: //Y Axis mov.y = movement; break; case 2: //Z Axis mov.z = movement; break; } SceneProp prop = GetSceneProp(propInstanceID); if (prop != null) { prop.Move(mov); } }
public ControlObjectTypeSceneProp(SceneProp propInstance) { this.propInstance = propInstance; }
void init_scenePropStruct(int n, int n1, int actornum, int sound, int trsId, byte r, byte g, byte b, int counter, int maxCounter, int index) { _sceneProp[n] = new SceneProp(); _sceneProp[n].actor = actornum; // main actor number, -1 if not applicable _sceneProp[n].sound = sound; _sceneProp[n].trsId = trsId; _sceneProp[n].r = r; _sceneProp[n].g = g; _sceneProp[n].b = b; _sceneProp[n].counter = counter; _sceneProp[n].maxCounter = maxCounter; _sceneProp[n].index = index; }