Beispiel #1
0
    void Update()
    {
        if (_charScript.canUpdate)
        {
            int currRoomId = ObjectCache.instance.dungeon.GetRoomIdFromPosition(transform.position);
            if (currRoomId == -1)
            {
                return;
            }
            if (prevRoomId != -1 && lastProcessedId != prevRoomId)
            {
                DungeonElements elements = ObjectCache.instance.dungeon.GetRoomById(prevRoomId).roomData.dungeonElements;
                if (elements.shop.Count > 0)
                {
                    elements.shop[0].GetComponent <InGameShop>().ShowTextMesh(false);
                }
                //activate exit particle only if player is in the same room
                foreach (var exitObj in elements.exitObjects)
                {
                    if (exitObj.isLevelExit)
                    {
                        exitObj.ShowExitParticle(false);
                    }
                    else
                    {
                        exitObj.ShowNormalParticle(false);
                    }
                }

                lastProcessedId = prevRoomId;
            }
            if (currRoomId != currentRoomId)
            {
                prevRoomId    = currentRoomId;
                currentRoomId = currRoomId;
                DungeonElements elements = ObjectCache.instance.dungeon.GetRoomById(currentRoomId).roomData.dungeonElements;
                //activate text mesh only if player is in the same room
                if (elements.shop.Count > 0)
                {
                    elements.shop[0].GetComponent <InGameShop>().ShowTextMesh(true);
                }
                //activate exit particle only if player is in the same room
                foreach (var exitObj in elements.exitObjects)
                {
                    if (exitObj.isLevelExit)
                    {
                        exitObj.ShowExitParticle(true);
                    }
                    else
                    {
                        exitObj.ShowNormalParticle(true);
                    }
                }
                if (PlayerModel.GetInstance().IsGuideActive)
                {
                    ObjectCache.instance.dungeon.SetGuideLampForRoomId(currentRoomId);
                }
            }
        }
    }
Beispiel #2
0
 public BSPNode()
 {
     rect                 = null;
     regionId             = -1;
     roomRect             = null;
     childNodes           = null;
     exitConfig           = new List <ExitConfig>();
     exitPositions        = new List <Vector3>();
     exitDoorPositions    = new List <Vector3>();
     connectedNodes       = new List <BSPNode>();
     _connectingPositions = new List <Vector3>();
     dungeonElements      = new DungeonElements();
     color                = new Color(UnityEngine.Random.Range(0, 255) / 255.0f, UnityEngine.Random.Range(0, 255) / 255.0f, UnityEngine.Random.Range(0, 255) / 255.0f);
 }
Beispiel #3
0
 public BSPNode(CustomRect rect)
 {
     regionId             = -1;
     this.rect            = rect;
     this.roomRect        = null;
     childNodes           = null;
     id                   = runningIndex++;
     exitConfig           = new List <ExitConfig>();
     exitPositions        = new List <Vector3>();
     exitDoorPositions    = new List <Vector3>();
     connectedNodes       = new List <BSPNode>();
     _connectingPositions = new List <Vector3>();
     dungeonElements      = new DungeonElements();
     color                = new Color(UnityEngine.Random.Range(0, 255) / 255.0f, UnityEngine.Random.Range(0, 255) / 255.0f, UnityEngine.Random.Range(0, 255) / 255.0f);
 }