Пример #1
0
    // Start is called before the first frame update
    void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else if (instance != null)
        {
            Destroy(gameObject);
        }

        if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            other         = GameObject.FindWithTag("MainCamera").GetComponent <NewCameraMoveLevel2>();
            spawnPosition = spawnPosition2;
        }
        else
        {
            other1        = GameObject.FindWithTag("MainCamera").GetComponent <NewCameraMove>();
            spawnPosition = spawnPosition1;
        }

        _audioSource = GetComponent <AudioSource>();
        //spawnPosition = GameObject.FindGameObjectsWithTag("Respawn");
        _player = GameObject.FindWithTag("Player");
        _anim   = GetComponentsInChildren <Animator>();
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        //放在重载后太快,无法检测到生成物体
        if (_controlFlag)
        {
            if (SceneManager.GetActiveScene().buildIndex == 1)
            {
                other         = GameObject.FindWithTag("MainCamera").GetComponent <NewCameraMoveLevel2>();
                spawnPosition = spawnPosition2;
            }
            else
            {
                other1        = GameObject.FindWithTag("MainCamera").GetComponent <NewCameraMove>();
                spawnPosition = spawnPosition1;
            }
            //spawnPosition = GameObject.FindGameObjectsWithTag("Respawn");
            _player = GameObject.FindWithTag("Player");
            _player.transform.position = spawnPosition[SpawnIndex].transform.position;
            _controlFlag = false;
        }

        if (_player && _player.GetComponent <Movement>().isDeath&& !_hasDead)
        {
            /*SpawnIndex = other.nowMapIndex;
             * deadPosition = _player.transform;
             * _controlFlag = true;
             * EndScene();
             * Destroy(_player);
             * _player = null;
             * StartScene();*/
            StartCoroutine(Event());
        }
    }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     CameraMoveLevel2 = GameObject.FindObjectOfType <NewCameraMoveLevel2>();
     DegreeMask       = GetComponentsInChildren <Transform>();
     _index_on        = CameraMoveLevel2.cameraNowMapIndex;
     foreach (var VARIABLE in DegreeMask)
     {
         VARIABLE.gameObject.SetActive(false);
     }
     DegreeMask[0].gameObject.SetActive(true);
     DegreeMask[_index_on + 1].gameObject.SetActive(true);
 }