private void OnDestroy() { if (singleton == this) { singleton = null; } }
void Start() { //Chamar referencias Trap = GameObject.FindGameObjectWithTag("Trap"); TrapScript = Trap.GetComponent <Trap2>(); Trap3 = GameObject.FindGameObjectWithTag("Trap2"); TrapScript2 = Trap3.GetComponent <Trap3>(); ArrowSpawner = GameObject.FindGameObjectWithTag("ArrowSpawner"); // Define ArrowSpawner como o objeto VelocidadeATK = ArrowSpawner.GetComponent <ArrowSpawn>(); player = GameObject.FindGameObjectWithTag("Player"); // define player como a tag Player playerHealth = player.GetComponent <Player_HP>(); // define playerHealth como o script Player HP Anim = GetComponent <Animator>(); LevelLoader = GameObject.Find("LevelLoader"); LVLScript = LevelLoader.GetComponent <LevelLoader>(); audioS = gameObject.GetComponent <AudioSource>(); // cor do boss SprRen = GetComponent <SpriteRenderer>(); // Define vida VidaInicial = 230; VidaAtual = VidaInicial; BossSlider.value = VidaInicial; // Tempo dos ataques tempoATK = Random.Range(minTime, MaxTime); // define que o tempo sera um random entre o minimo e max }
private void Awake() { if (singleton == null) { singleton = this; } }
private void Awake() { if (ArrowSpawn.instance == null) { ArrowSpawn.instance = this; } }
// Void Start override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // Chamando definições Trap = GameObject.FindGameObjectWithTag("Trap"); TrapScript = Trap.GetComponent <Trap2>(); Trap3 = GameObject.FindGameObjectWithTag("Trap2"); TrapScript2 = Trap3.GetComponent <Trap3>(); ArrowSpawner = GameObject.FindGameObjectWithTag("ArrowSpawner"); SpawnFlecha = ArrowSpawner.GetComponent <ArrowSpawn>(); Boss = GameObject.FindGameObjectWithTag("Boss"); BossStage = Boss.GetComponent <BossScript>(); timer = Random.Range(minTime, MaxTime); }