Esempio n. 1
0
    public override void OnPickup()
    {
        base.OnPickup();

        if (changeSpawnPoint >= 0 && !GameSaveManager.isLoading)
        {
            PlayerSaving.SetExitID(changeSpawnPoint);
            GameSaveManager.SaveRoom();
        }
    }
Esempio n. 2
0
    void OnInteractStart(PlayerController source)
    {
        _Item item = source.inventory.equipped;

        if (item == null)
        {
            return;
        }
        if (item is _CoreItem)
        {
            return;
        }

        if (item.id == rodID && wheelInPlace)
        {
            // Place rod
            item.SendMessage(ItemMethods.OnItemDroppedOff, this, SendMessageOptions.DontRequireReceiver);
            Destroy(item.gameObject);

            rodRenderer.enabled = true;
            anim.SetBool("RodInPlace", true);
            electricPlayer.enabled = true;

            if (saveAfterItemAdded)
            {
                PlayerSaving.SetExitID(spawnPoint);
                StartCoroutine(GameSaveManager.SaveRoomWait());
            }
        }
        else if (item.id == wheelID && !wheelInPlace)
        {
            // Place wheel
            item.SendMessage(ItemMethods.OnItemDroppedOff, this, SendMessageOptions.DontRequireReceiver);
            Destroy(item.gameObject);

            wheelRenderer.enabled = true;

            if (saveAfterItemAdded)
            {
                PlayerSaving.SetExitID(spawnPoint);
                StartCoroutine(GameSaveManager.SaveRoomWait());
            }
        }
    }
    void OnTriggerEnter(Collider col)
    {
        if (!works)
        {
            return;
        }

        GameObject main = col.GetMainObject();

        if (main.tag == "Player")
        {
            if (filter && PlayerController.instance.movement.autoMoveID != idMustBe)
            {
                return;
            }

            works = false;

            PlayerSaving.SetExitID(exitID);

            // Spawn loading screen
            GameSaveManager.SaveRoom();
            if (openCredits)
            {
                // Load with a delegate callback
                LoadingScreen.LoadRoom(gotoRoomOnTrigger, ls => {
                    // Loaded callback
                    var buttonActions = FindObjectOfType <ButtonActions>();
                    if (buttonActions)
                    {
                        buttonActions.OpenCreditsMenu();
                    }
                });
                BatteryGolemAnalytics.SendGameCompletedEvent();
            }
            else
            {
                // Load normally
                LoadingScreen.LoadRoom(gotoRoomOnTrigger);
            }
        }
    }