// Update is called once per frame void Update() { if (_drone) { transform.LookAt(new Vector3(_drone.transform.position.x, transform.position.y, _drone.transform.position.z)); } else { _drone = GameManager.instance.Drone; } }
public void Setup() { if (SceneManager.GetActiveScene().buildIndex == 1) { Level_Manager.EnemiesAI.Clear(); if (!Player) { Player = FindObjectOfType <PlayerMovController>(); } if (!Drone) { Drone = FindObjectOfType <DroneMoveController>(); } /* if (Level_Manager.EnemiesAI.Count == 0) */ Level_Manager.EnemiesAI = FindObjectsOfType <EnemyAI>().ToList(); if (!Level_Manager.Level) { Level_Manager.Level = FindObjectOfType <PezzaMissingLevel>().gameObject; } if (AllPossiblekey.Count == 0 || !AllPossiblekey[0]) { AllPossiblekey = FindObjectsOfType <KeySpot>().ToList(); } if (!Key) { int _keyIndex = UnityEngine.Random.Range(0, AllPossiblekey.Count); for (int i = 0; i < AllPossiblekey.Count; i++) { if (i == _keyIndex) { Key = AllPossiblekey[i]; Key.gameObject.SetActive(true); } else { AllPossiblekey[i].gameObject.SetActive(false); } } } if (!Treasure) { Treasure = FindObjectOfType <Capsulo>(); } } }
// Start is called before the first frame update void Start() { _drone = GameManager.instance.Drone; }