示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            if (StaticCheckpointController.FindCheckPointValue(this))
            {
                StaticCheckpointController.SetCheckPointValue(this);
                Debug.Log("The Player activated checkpoint");
                checkpointController.UpdateCheckpoints(this.gameObject);
                var pos = other.gameObject.transform.position;
                StaticCheckpointController.SetupHere(pos);

                var Loader = FindObjectOfType <NewSaveAndLoad>();
                if (Loader != null)
                {
                    var path = Loader.dataPathPos;
                    Loader.DeleteSave(path);
                    Loader.SavePlayerPosition(pos, path);
                    Loader.SaveCheckpoints(StaticCheckpointController.checkPointList);
                }
                else
                {
                    Debug.Log("there should be a save and load prefab in the scene if this is the big level, otherwise no save for you");
                }
            }
        }
    }
示例#2
0
    public void ContinueGame()
    {
        var Loader = FindObjectOfType <NewSaveAndLoad>();

        if (Loader != null)
        {
            var path = Loader.dataPathPos;
            if (Loader.SaveExists(path))
            {
                Vector3 pos = Loader.LoadPlayerPosition(path);
                StaticCheckpointController.SetupHere(pos);
                var smList = Loader.LoadCheckpoints();
                if (smList == null)
                {
                    Debug.Log(smList);
                }
                Debug.Log(smList.Length);
                Debug.Log("HERE");
                StaticCheckpointController.checkPointList = smList;
                SceneManager.LoadScene("BigLevel1", LoadSceneMode.Single);
            }
        }
        else
        {
            Debug.Log("there should be a save and load prefab in the scene");
        }
    }
示例#3
0
    void Start()
    {
        carrying     = false;
        carriedObj   = null;
        charCont     = GetComponent <CharacterController>();
        currentSpeed = runSpeed;
        aSwitcher    = gameObject.GetComponent <AudioSwitcherScript>();
        //loadAgain = true;
        if (aSwitcher == null)
        {
            Debug.Log("player object does not have a audio switcher script");
        }

        if (StaticCheckpointController.shouldTrigger)
        {
            WarpTo(StaticCheckpointController.WhereToSpawn());
        }
        currentStamina    = MaxStamina;
        sprintSpeed       = runSpeed;
        staminaBarDisplay = GameObject.Find("StamBar").GetComponent <Image>();
        staminaBarDisplay.gameObject.SetActive(false);
        staminaBarDisplay.fillAmount = staminaMaxFill;
        staminaBarText         = GameObject.Find("StamBarText").GetComponent <Text>();
        staminaBarText.enabled = false;
    }
示例#4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         StaticCheckpointController.MovingToNewLevel();
         SceneManager.LoadScene(nextLevelInt);
     }
 }
示例#5
0
    public PlayerData(KE_MainPlayer_Script player)
    {
        health       = player.GetComponent <AMS_Health_Management>().currentHealth;
        ammoClips1   = player.GetComponent <AMS_GunManagement>().currentClips;
        ammoClips2   = player.GetComponent <AMS_GunManagement>().gun2currentClips;
        ammo1        = player.GetComponent <AMS_GunManagement>().currentAmmo;
        ammo2        = player.GetComponent <AMS_GunManagement>().gun2currentAmmo;
        unlocked     = player.GetComponent <AMS_GunManagement>().unlocked;
        currentLevel = player.GetComponent <MainMenu>().levelIndex;
        altFireammo  = player.GetComponent <AMS_GunManagement>().defaultAlternateFireAmmo;
        currentGun   = player.GetComponent <AMS_GunManagement>().currentGun;
        var chSpawn = StaticCheckpointController.WhereToSpawn();

        spawn[0] = (int)chSpawn.x;
        spawn[1] = (int)chSpawn.y;
        spawn[2] = (int)chSpawn.z;
    }