示例#1
0
    public void UnsealDoor(DungeonRoomInfo.WallDirection dir)
    {
        if (!IsDoorSealed(dir))
        {
            return;
        }
        SetWallTypeForDirection(dir, DungeonRoomInfo.WallType.DoorOpen);

        PlayUnlockSound();
    }
示例#2
0
    public void SetWallTypeForDirection(DungeonRoomInfo.WallDirection direction, DungeonRoomInfo.WallType type)
    {
        Info.SetWallTypeForDirection(direction, type);

        // Now we update the wall's Material
        GameObject wall = GetWallForDirection(direction);

        wall.GetComponent <Renderer>().material = CommonObjects.CurrentDungeonFactory.GetWallMaterial(direction, type);
        wall.GetComponent <LightsOnOffMaterial>().OnMaterialChanged();
    }
示例#3
0
    void AssignToWall(DungeonRoomInfo.WallDirection newWallDir)
    {
        wallDir = newWallDir;

        if (WorldInfo.Instance.IsInDungeon)
        {
            DungeonRoom dr = _enemy.DungeonRoomRef;
            wall = dr.GetWallForDirection(wallDir);
        }

        _wallNormal  = DungeonRoomInfo.NormalForWallDirection(wallDir);
        _wallTangent = DungeonRoomInfo.TangentForWallDirection(wallDir);
        if (Extensions.FlipCoin())
        {
            _wallTangent *= -1;
        }
    }
示例#4
0
    public void OnPlayerEnteredRoom(DungeonRoomInfo.WallDirection direction = DungeonRoomInfo.WallDirection.None)
    {
        PlayerHasVisited = true;

        if (!EnemiesHaveSpawned)
        {
            SpawnEnemies();

            if (ContainsBoss && ALWAYS_SEAL_DOORS_FOR_BOSS)
            {
                SealDoors();
            }

            if (ContainsGannon)
            {
                PlaySequence_GannonIntro();
            }
        }

        if (NeedTriforceToPass && Inventory.Instance.HasAllTriforcePieces())
        {
            UnsealDoors();
        }

        if (direction != DungeonRoomInfo.WallDirection.None)
        {
            if (GetWallTypeForDirection(direction) == DungeonRoomInfo.WallType.DoorSealed)
            {
                PlaySealDoorSound();
            }
        }

        if (WillShowNpcText)
        {
            ShowNpcText();
        }

        if (ContainsSubDungeonSpawnPoint)
        {
            if (!Info.pushBlockSpawnsSubDungeon || _hasPushBlockBeenPushed)
            {
                SpawnSubDungeon();
            }
        }
    }
示例#5
0
    public void UnlockDoor(DungeonRoomInfo.WallDirection dir)
    {
        if (!IsDoorLocked(dir))
        {
            //Debug.LogError("Trying to Unlock door that is not Locked.");
            return;
        }
        SetWallTypeForDirection(dir, DungeonRoomInfo.WallType.DoorOpen);

        DungeonRoom adjoiningRoom = GetAdjoiningRoom(dir);

        if (adjoiningRoom != null)
        {
            adjoiningRoom.UnlockDoor(DungeonRoomInfo.GetOppositeDirection(dir));
        }

        PlayUnlockSound();
    }
示例#6
0
    public GameObject GetWallForDirection(DungeonRoomInfo.WallDirection direction)
    {
        GameObject wall = null;

        switch (direction)
        {
        case DungeonRoomInfo.WallDirection.North: wall = wall_N; break;

        case DungeonRoomInfo.WallDirection.East: wall = wall_E; break;

        case DungeonRoomInfo.WallDirection.South: wall = wall_S; break;

        case DungeonRoomInfo.WallDirection.West: wall = wall_W; break;

        default: break;
        }
        return(wall);
    }
示例#7
0
    public DungeonRoom GetAdjoiningRoom(DungeonRoomInfo.WallDirection dir)
    {
        DungeonRoom dr = null;

        switch (dir)
        {
        case DungeonRoomInfo.WallDirection.North: dr = NorthRoom; break;

        case DungeonRoomInfo.WallDirection.East: dr = EastRoom; break;

        case DungeonRoomInfo.WallDirection.South: dr = SouthRoom; break;

        case DungeonRoomInfo.WallDirection.West: dr = WestRoom; break;

        default: break;
        }
        return(dr);
    }
示例#8
0
    public void BlowHoleInWall(DungeonRoomInfo.WallDirection dir)
    {
        if (IsWallBombedOpen(dir))
        {
            //Debug.LogError("Trying to Blow Hole In Wall that is already bombed open.");
            return;
        }
        if (!Info.IsBombable(dir))
        {
            Debug.LogError("Trying to Blow Hole In Wall that is not bombable.");
            return;
        }
        SetWallTypeForDirection(dir, DungeonRoomInfo.WallType.Bombed);

        DungeonRoom adjoiningRoom = GetAdjoiningRoom(dir);

        if (adjoiningRoom != null)
        {
            adjoiningRoom.BlowHoleInWall(DungeonRoomInfo.GetOppositeDirection(dir));
        }
    }
示例#9
0
    void BlastWall(GameObject wall)
    {
        Transform p1 = wall.transform.parent;

        if (p1 == null)
        {
            return;
        }

        Transform p2 = p1.parent;

        if (p2 == null)
        {
            return;
        }

        DungeonRoom dr = p2.GetComponent <DungeonRoom>();

        if (dr == null)
        {
            return;
        }

        DungeonRoomInfo.WallDirection wallDir = dr.GetWallDirectionForWall(wall);
        if (!dr.Info.IsBombable(wallDir))
        {
            return;
        }

        Vector3 wallCenter = wall.transform.position;

        wallCenter.y = 0;
        float dist = Vector3.Distance(wallCenter, transform.position);

        if (dist < radius * 1.5f)
        {
            dr.BlowHoleInWall(wallDir);
        }
    }
示例#10
0
    public DungeonRoomInfo.WallDirection GetWallDirectionForWall(GameObject wall)
    {
        DungeonRoomInfo.WallDirection wallDir = DungeonRoomInfo.WallDirection.None;

        if (wall == wall_N)
        {
            wallDir = DungeonRoomInfo.WallDirection.North;
        }
        else if (wall == wall_E)
        {
            wallDir = DungeonRoomInfo.WallDirection.East;
        }
        else if (wall == wall_S)
        {
            wallDir = DungeonRoomInfo.WallDirection.South;
        }
        else if (wall == wall_W)
        {
            wallDir = DungeonRoomInfo.WallDirection.West;
        }

        return(wallDir);
    }
示例#11
0
    public Material GetWallMaterial(DungeonRoomInfo.WallDirection direction, DungeonRoomInfo.WallType wallType)
    {
        bool     northSouthWall = DungeonRoomInfo.IsNorthOrSouth(direction);
        Material mat            = null;

        switch (wallType)
        {
        case DungeonRoomInfo.WallType.Closed:
            mat = northSouthWall ? wall : wall_EW;
            break;

        case DungeonRoomInfo.WallType.DoorOpen:
            mat = northSouthWall ? wallOpen : wallOpen_EW;
            break;

        case DungeonRoomInfo.WallType.DoorSealed:
            mat = northSouthWall ? wallSealed : wallSealed_EW;
            break;

        case DungeonRoomInfo.WallType.DoorLocked:
            mat = northSouthWall ? wallLocked : wallLocked_EW;
            break;

        case DungeonRoomInfo.WallType.Bombed:
            mat = northSouthWall ? wallBombed : wallBombed_EW;
            break;

        case DungeonRoomInfo.WallType.Top:
            mat = northSouthWall ? wallTop : wallTop_EW;
            break;

        default:
            break;
        }

        return(mat);
    }
示例#12
0
 public bool IsDoorSealed(DungeonRoomInfo.WallDirection dir)
 {
     return(GetWallTypeForDirection(dir) == DungeonRoomInfo.WallType.DoorSealed);
 }
示例#13
0
 public bool IsWallBombedOpen(DungeonRoomInfo.WallDirection dir)
 {
     return(GetWallTypeForDirection(dir) == DungeonRoomInfo.WallType.Bombed);
 }
示例#14
0
 public bool CanPassThrough(DungeonRoomInfo.WallDirection direction)
 {
     return(Info.CanPassThrough(direction));
 }
示例#15
0
 public DungeonRoomInfo.WallType GetWallTypeForDirection(DungeonRoomInfo.WallDirection direction)
 {
     return(Info.GetWallTypeForDirection(direction));
 }
示例#16
0
 void AssignToRandomWall()
 {
     DungeonRoomInfo.WallDirection d = WorldInfo.Instance.IsInDungeon ? DungeonRoomInfo.GetRandomWallDirection() : wallDir;
     AssignToWall(d);
 }