Exemple #1
0
 // Reset certain values BEFORE the player enters a new scene
 public void ClearPlayerBeforeSceneChange(Scene scene)
 {
     GetComponentInChildren <AllomechanicalGlower>().RemoveAllEmissions();
     movementController.Clear();
     PlayerIronSteel.Clear(false);
     PlayerPewter.Clear();
     PlayerZinc.Clear();
 }
Exemple #2
0
 void Update()
 {
     if (CanControlPlayer)
     {
         if (Keybinds.ToggleCoinshotMode())
         {
             CoinshotMode = !CoinshotMode;
         }
         // On throwing a coin
         if ((CoinshotMode && Keybinds.IronPulling() && Keybinds.SteelPushing() || Keybinds.WithdrawCoinDown()) && lastCoinThrowTime + (coinCooldown * Time.timeScale) < Time.time)
         {
             lastCoinThrowTime = Time.time;
             PlayerIronSteel.AddPushTarget(CoinHand.WithdrawCoinToHand());
         }
     }
 }
Exemple #3
0
    // Reset certain values AFTER the player enters a new scene
    private void ClearPlayerAfterSceneChange(Scene scene, LoadSceneMode mode)
    {
        if (mode == LoadSceneMode.Single)   // Not loading all of the scenes, as it does at startup
        {
            PlayerIronSteel.Clear();
            SetFrameMaterial(frameMaterial);
            CanControlPlayer = true;
            //if (scene.buildIndex == SceneSelectMenu.sceneLevel01)
            //    GodMode = true;
            //else
            if (scene.buildIndex == SceneSelectMenu.sceneLevel01)
            {
                CoinHand.Pouch.Clear();
                PlayerIronSteel.IronReserve.SetMass(0);
                PlayerIronSteel.SteelReserve.SetMass(0);
                PlayerPewter.PewterReserve.SetMass(0);
            }
            else
            {
                // For every scene except the tutorial, give metals and coins at the start.
                CoinHand.Pouch.Fill();
                PlayerIronSteel.IronReserve.SetMass(150);
                PlayerIronSteel.SteelReserve.SetMass(150);
                PlayerPewter.PewterReserve.SetMass(100);
            }
            GodMode = false;

            GameObject spawn = GameObject.FindGameObjectWithTag("PlayerSpawn");
            if (spawn && CameraController.ActiveCamera)   // if CameraController.Awake has been called
            {
                transform.position = spawn.transform.position;
                transform.rotation = spawn.transform.rotation;
                CameraController.Clear();
            }
        }
    }