Example #1
0
        void Update()
        {
            // Track which dungeon block player is inside of
            if (dungeon && isPlayerInsideDungeon)
            {
                int playerBlockIndex = dungeon.GetPlayerBlockIndex(transform.position);
                if (playerBlockIndex != lastPlayerDungeonBlockIndex)
                {
                    dungeon.GetBlockData(playerBlockIndex, out playerDungeonBlockData);
                    lastPlayerDungeonBlockIndex = playerBlockIndex;
                    CastleCheck();
                    SpecialAreaCheck();
                    //Debug.Log(string.Format("Player is now inside block {0}", playerDungeonBlockData.BlockName));
                }
            }

            // Count down holiday text display
            if (holidayTextTimer > 0)
            {
                holidayTextTimer -= Time.deltaTime;
            }
            if (holidayTextTimer <= 0 && holidayTextPrimed)
            {
                holidayTextPrimed = false;
                ShowHolidayText();
            }
        }
        void Update()
        {
            // Track which dungeon block player is inside of
            if (dungeon && isPlayerInsideDungeon)
            {
                int playerBlockIndex = dungeon.GetPlayerBlockIndex(transform.position);
                if (playerBlockIndex != lastPlayerDungeonBlockIndex)
                {
                    dungeon.GetBlockData(playerBlockIndex, out playerDungeonBlockData);
                    lastPlayerDungeonBlockIndex = playerBlockIndex;
                    blockWaterLevel             = playerDungeonBlockData.WaterLevel;
                    isPlayerInsideDungeonCastle = playerDungeonBlockData.CastleBlock;
                    SpecialAreaCheck();
                    //Debug.Log(string.Format("Player is now inside block {0}", playerDungeonBlockData.BlockName));
                }
            }

            // Count down holiday text display
            if (holidayTextTimer > 0)
            {
                holidayTextTimer -= Time.deltaTime;
            }
            if (holidayTextTimer <= 0 && holidayTextPrimed)
            {
                holidayTextPrimed = false;
                ShowHolidayText();
            }

            // NOTE: Player's y value in DF unity is 0.95 units off from classic, so subtracting it to get correct comparison
            if (blockWaterLevel == 10000 || (player.transform.position.y + (50 * MeshReader.GlobalScale) - 0.95f) >= (blockWaterLevel * -1 * MeshReader.GlobalScale))
            {
                isPlayerSwimming        = false;
                fakeLevitate.IsSwimming = false;
            }
            else
            {
                if (!isPlayerSwimming)
                {
                    SendMessage("PlayLargeSplash", SendMessageOptions.DontRequireReceiver);
                }
                isPlayerSwimming        = true;
                fakeLevitate.IsSwimming = true;
            }

            // Check if player is submerged and needs to start holding breath
            if (blockWaterLevel == 10000 || (player.transform.position.y + (76 * MeshReader.GlobalScale) - 0.95f) >= (blockWaterLevel * -1 * MeshReader.GlobalScale))
            {
                isPlayerSubmerged = false;
            }
            else
            {
                isPlayerSubmerged = true;
            }
        }
 void Update()
 {
     // Track which dungeon block player is inside of
     if (dungeon && isPlayerInsideDungeon)
     {
         int playerBlockIndex = dungeon.GetPlayerBlockIndex(transform.position);
         if (playerBlockIndex != lastPlayerDungeonBlockIndex)
         {
             dungeon.GetBlockData(playerBlockIndex, out playerDungeonBlockData);
             lastPlayerDungeonBlockIndex = playerBlockIndex;
             PalaceCheck();
             //Debug.Log(string.Format("Player is now inside block {0}", playerDungeonBlockData.BlockName));
         }
     }
 }