//Looks like it changes a range of textures on TMAPs between the trap of the trigger object and the trap //Tmaps with an owner == 63 gets changed to 40 plus traps owner and their texture changes accordingly //This implementation is not fully correct yet! public override void ExecuteTrap(object_base src, int triggerX, int triggerY, int State) { int minX = Mathf.Min(triggerX, src.objInt().tileX); int minY = Mathf.Min(triggerY, src.objInt().tileY); int maxX = Mathf.Max(triggerX, src.objInt().tileX); int maxY = Mathf.Max(triggerY, src.objInt().tileY); //Ignore the range for the moment. minX = 0; minY = 0; maxX = 63; maxY = 63; ObjectLoaderInfo[] objList = GameWorldController.instance.CurrentObjectList().objInfo; for (int i = 0; i <= objList.GetUpperBound(0); i++) { if ((objList[i].item_id == 366) || (objList[i].item_id == 367)) { if (objList[i].instance != null) { if ( (objList[i].instance.tileX >= minX) && (objList[i].instance.tileX <= maxX) && (objList[i].instance.tileY >= minY) && (objList[i].instance.tileY <= maxX) ) { if (objList[i].instance.owner == 63) { TMAP tmap = objList[i].instance.GetComponent <TMAP>(); if (tmap != null) { tmap.objInt().owner = (short)(40 + objInt().owner); tmap.TextureIndex = GameWorldController.instance.currentTileMap().texture_map[40 + objInt().owner]; TMAP.CreateTMAP(tmap.gameObject, tmap.TextureIndex); } } } } } } }
public override void ExecuteTrap(object_base src, int triggerX, int triggerY, int State) { if (link != 0) { GameObject obj = ObjectLoader.getGameObjectAt(link); if (obj != null) { TMAP tmap = obj.GetComponent <TMAP>(); if (tmap != null) { tmap.owner = owner; tmap.TextureIndex = CurrentTileMap().texture_map[owner]; TMAP.CreateTMAP(obj, tmap.TextureIndex); } else { Debug.Log("no tmap found on " + obj.name); } } } }
// TODO: make redundant /// <summary> /// Loads a Torii map and returns a gameobject with entities in the torii map as child elements /// </summary> public static GameObject LoadToriiMap(string filePath, ResourceLifespan lifespan, out TMAP tmap) { // TODO: handle missing files tmap = ResourceManager.Load <TMAP>(filePath, lifespan); GameObject tmapObject = new GameObject(tmap.Header.Name); foreach (ENTITY e in tmap.Content.Entities) { GameObject entityObject = EntityInstantiator.Instantiate(e); entityObject.transform.SetParent(tmapObject.transform); } return(tmapObject); }