objInt() public method

Gets the object interaction that this object base works with
public objInt ( ) : ObjectInteraction,
return ObjectInteraction,
示例#1
0
    public override void ExecuteTrap(object_base src, int triggerX, int triggerY, int State)
    {
        int xPos     = src.objInt().x;
        int yPos     = src.objInt().y;
        int variable = Quest.instance.variables[6];

        //x and y positions are as follows.
        //2,7
        //7,3
        //5,6
        //7,4
        //6,0
        //1,6
        if (TestPosXY(xPos, yPos, 2, 7))
        {
            //Debug.Log("Found 2,7");
            TravelToWorlds(variable, Tomb, Pits);
        }
        else if (TestPosXY(xPos, yPos, 7, 3))
        {
            //	Debug.Log("Found 7,3");
            TravelToWorlds(variable, Scintillus, Pits);
        }
        else if (TestPosXY(xPos, yPos, 5, 6))
        {                        //Always prison tower
            //Debug.Log("Found 5,6");
            //Debug.Log("Travel to world " + PrisonTower);
            TravelToWorlds(variable, PrisonTower, PrisonTower);
        }
        else if (TestPosXY(xPos, yPos, 7, 4))
        {                        //Kilhorn and Ice caverns
            TravelToWorlds(variable, Killorn, IceCaverns);
        }
        else if (TestPosXY(xPos, yPos, 6, 0))
        {
            //Debug.Log("Found 6,0");
            TravelToWorlds(variable, Talorus, Scintillus);
        }
        else if (TestPosXY(xPos, yPos, 1, 6))
        {
            //Debug.Log("Found 4,6");
            TravelToWorlds(variable, Tomb, EtherealVoid);
        }
        else
        {
            Debug.Log("Unable to match a move trigger");
        }
    }
示例#2
0
 public override void PostActivate(object_base src)
 {
     if ((int)(src.objInt().flags & 0x1) == 1)
     {
         //Do not delete as src trap/trigger is set to repeat
     }
     else
     {
         base.PostActivate(src);
     }
 }
示例#3
0
    //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);
                            }
                        }
                    }
                }
            }
        }
    }
示例#4
0
    /// <summary>
    /// Randomly teleports based on the moongate in the same tile
    /// </summary>
    /// <param name="src">Source.</param>
    void RandomTeleport(object_base src)
    {
        ObjectInteraction obj = null;

        if (FindMoongateInTile((int)src.objInt().tileX, (int)src.objInt().tileY, out obj))
        {        //not all teleport locations are confirmed!
            switch (obj.link)
            {
            case 545:            //Red
            case 557:            //Red on red hell
                TeleportRed(); break;

            case 591:             //blue
                TeleportBlue(); break;

            case 603:             //purple
                TeleportPurple(); break;

            case 528:             //Yellow
                TeleportYellow(); break;
            }
        }
    }
/*
 * A change terrain trap changes a tile from one type to another. It works over a range of tiles that are set by the traps
 * x,y values. In Underworld these are set by the the relative position of the trap within the tile.
 * The tile it acts on is controlled by the trigger.
 *
 * Examples of it's usage
 * The Moonstone room on Level2
 * The path to the sword hilt on Level3
 *
 */

    public override void ExecuteTrap(object_base src, int triggerX, int triggerY, int State)
    {
        //Debug.Log (this.name);
        int textureQuality = (objInt().quality >> 1) & 0xf;

        for (short x = 0; x <= objInt().x; x++)
        {
            for (short y = 0; y <= objInt().y; y++)
            {
                short      tileXToChange = (short)(x + triggerX);
                short      tileYToChange = (short)(y + triggerY);
                GameObject tile          = GameWorldController.FindTile(tileXToChange, tileYToChange, TileMap.SURFACE_FLOOR);
                if (tile != null)
                {
                    TileInfo tileToChange = GameWorldController.instance.currentTileMap().Tiles[tileXToChange, tileYToChange];
                    //Destroy (tile);

                    switch (_RES)
                    {                            //I will probably have to change this again!
                    //case GAME_UW2:
                    //	tileToChange.floorTexture=textureQuality;
                    //	break;
                    default:
                        if (textureQuality < 10)
                        {
                            tileToChange.floorTexture = (short)textureQuality;                                  //+48;
                            //tileToChange.floorTexture=GameWorldController.instance.currentTileMap().texture_map[textureQuality+48];
                        }
                        break;
                    }

                    //currobj.zpos >> 2
                    //(objList[k].zpos >> 2);
                    tileToChange.Render = true;
                    for (int v = 0; v < 6; v++)
                    {
                        tileToChange.VisibleFaces[v] = true;
                    }
                    short tileTypeToChangeTo = (short)(objInt().quality & 0x01);
                    short newTileHeight;         // = (short)(objInt().zpos>>2);
                    if (objInt().zpos == 120)
                    {                            //If at this height use the trigger zpos for height instead.
                        newTileHeight = (short)(src.objInt().zpos >> 2);
                    }
                    else
                    {
                        newTileHeight = (short)(objInt().zpos >> 2);
                    }
                    short newWallTexture = tileToChange.wallTexture;
                    if (_RES == GAME_UW2)
                    {                            //Also the owner can be used to change wall texture. This means changing it's neighours.
                        if (objInt().owner < 63)
                        {
                            newWallTexture = objInt().owner;
                        }
                    }

                    //tileToChange.tileType=tileTypeToChangeTo;
                    tileToChange.DimX = 1;
                    tileToChange.DimY = 1;

                    ////tileToChange.floorHeight=newTileHeight;
                    //tileToChange.floorHeight=tileToChange.floorHeight;//DOUBLE CHECK THIS
                    tileToChange.isWater = TileMap.isTextureWater(GameWorldController.instance.currentTileMap().texture_map[tileToChange.floorTexture]);
                    //TileMapRenderer.RenderTile(GameWorldController.instance.LevelModel,tileXToChange,tileYToChange,tileToChange,tileToChange.isWater,false,false,true);
                    tileToChange.TileNeedsUpdate();
                    TileMapRenderer.UpdateTile(tileXToChange, tileYToChange, tileTypeToChangeTo, newTileHeight, tileToChange.floorTexture, newWallTexture, false);
                    Destroy(tile);

                    if (tileToChange.isDoor)
                    {                            //The door may be rendered
                        GameObject door = GameWorldController.findDoor(tileToChange.tileX, tileToChange.tileY);
                        if (door != null)
                        {
                            string doorname = ObjectLoader.UniqueObjectName(door.GetComponent <ObjectInteraction>().objectloaderinfo);
                            DestroyDoorPortion("front_leftside_" + doorname);
                            DestroyDoorPortion("front_over_" + doorname);
                            DestroyDoorPortion("front_rightside_" + doorname);
                            DestroyDoorPortion("side1_filler_" + doorname);
                            DestroyDoorPortion("over_filler_" + doorname);
                            DestroyDoorPortion("side2_filler_" + doorname);
                            DestroyDoorPortion("front_filler_" + doorname);
                            DestroyDoorPortion("rear_leftside_" + doorname);
                            DestroyDoorPortion("rear_over_" + doorname);
                            DestroyDoorPortion("rear_rightside_" + doorname);
                            DestroyDoorPortion(doorname);
                            TileMapRenderer.RenderDoor(
                                GameWorldController.instance.DynamicObjectMarker().gameObject,
                                GameWorldController.instance.currentTileMap(),
                                GameWorldController.instance.CurrentObjectList(),
                                door.GetComponent <ObjectInteraction>().objectloaderinfo.index);

/*								TileMapRenderer.RenderDoorwayFront(
 *                                                              GameWorldController.instance.LevelModel,
 *                                                                                                      GameWorldController.instance.currentTileMap(),
 *                                                                                                      GameWorldController.instance.CurrentObjectList(),
 *                                                                                                      door.GetComponent<ObjectInteraction>().objectloaderinfo
 *                                                                                                      );
 *                                                              TileMapRenderer.RenderDoorwayRear(
 *                                                                                              GameWorldController.instance.LevelModel,
 *                                                                                              GameWorldController.instance.currentTileMap(),
 *                                                                                              GameWorldController.instance.CurrentObjectList(),
 *                                                                                              door.GetComponent<ObjectInteraction>().objectloaderinfo
 *                                                                                                      );*/
                            Vector3 objPos = door.transform.position;
                            ObjectInteraction.CreateNewObject(GameWorldController.instance.currentTileMap(),
                                                              door.GetComponent <ObjectInteraction>().objectloaderinfo,
                                                              GameWorldController.instance.CurrentObjectList().objInfo,
                                                              GameWorldController.instance.LevelModel, objPos
                                                              );
                        }
                    }
                }
                else
                {
                    Debug.Log(this.name + " Unable to find tile for change terrain trap " + tileXToChange + " " + tileYToChange);
                }
            }
        }

        GameWorldController.WorldReRenderPending = true;

        //	if ((objInt().owner<63) && (_RES==GAME_UW2))
        //	{
        //Now force re-render the tiles and their neighbours
        for (int x = -1; x <= objInt().x + 1; x++)
        {
            for (int y = -1; y <= objInt().y + 1; y++)
            {
                int tileXToChange = x + triggerX;
                int tileYToChange = y + triggerY;

                GameObject tile = GameWorldController.FindTile(tileXToChange, tileYToChange, TileMap.SURFACE_FLOOR);
                if (tile != null)
                {
                    Destroy(tile);
                }
                if ((tileXToChange >= 0) && (tileXToChange <= 63) && (tileYToChange >= 0) && (tileYToChange <= 63))
                {
                    TileInfo tileToChange = GameWorldController.instance.currentTileMap().Tiles[tileXToChange, tileYToChange];
                    tileToChange.Render = true;
                    for (int v = 0; v < 6; v++)
                    {
                        tileToChange.VisibleFaces[v] = true;
                    }
                    tileToChange.isWater = TileMap.isTextureWater(GameWorldController.instance.currentTileMap().texture_map[tileToChange.floorTexture]);
                    //TileMapRenderer.RenderTile(GameWorldController.instance.LevelModel,tileXToChange,tileYToChange,tileToChange,tileToChange.isWater,false,false,true);
                    tileToChange.TileNeedsUpdate();
                }
            }
        }
        //}
    }