// Update is called once per frame void Update() { GameObject objetoconscript = GameObject.Find("Game Manager"); GameObject objetoconscript2 = GameObject.Find("GameManager"); Players = objetoconscript.GetComponent <HeroesInstanceManager>(); EachPlayer = objetoconscript2.GetComponent <PlayerSpawnManagerAtTheBeginningOfTheScene>(); //P1 = Players.playerOne; //P2 = Players.playerTwo; P1 = EachPlayer.J1.gameObject; P2 = EachPlayer.J2.gameObject; DetectObject1(); DetectObject2(); }
// Use this for initialization void Start() { explosionPosition = transform.position; anim = GetComponent <Animator>(); renderSphere = GetComponent <MeshRenderer>(); SecondSphere.gameObject.SetActive(false); GameObject objetoconscript = GameObject.Find("Game Manager"); Players = objetoconscript.GetComponent <HeroesInstanceManager>(); P1 = Players.playerOne; P2 = Players.playerTwo; anim.SetBool("Spawn", true); this.gameObject.tag = this.transform.parent.gameObject.tag; }
// Update is called once per frame void Update() { Cooldown -= Time.deltaTime; GameObject objetoconscript = GameObject.Find("Game Manager"); Players = objetoconscript.GetComponent <HeroesInstanceManager>(); //P1 = Players.playerOne; //P2 = Players.playerTwo; P1 = GameObject.Find(Players.playerOneName); P2 = GameObject.Find(Players.playerTwoName); anim.SetBool("destroy", destroy); if (destroy == true) { anim.SetBool("destroy", true); renderSphere.enabled = false; SecondSphere.gameObject.SetActive(true); Destroy(this.gameObject, 1.5f); } if (Cooldown <= 10) { puntosVida = 10; } if (Cooldown <= 0) { puntosVida = 0; } if (puntosVida <= 10) { anim.SetBool("protect", true); } if (puntosVida <= 0) { destroy = true; } }
//public static SpawnManager instance; // Use this for initialization private void Awake() { //Establecer el valor de la referencia estatica if (instance == null) { instance = this; } else { if (instance != this) { Destroy(this.gameObject); } } //2. GameObject.DontDestroyOnLoad() -- Marca el gameObject para que no se destruya cuando "flushee" la escena DontDestroyOnLoad(this.gameObject); // DontDestroyOnLoad(player2); }
// Update is called once per frame void Update() { GameObject objetoconscript = GameObject.Find("Game Manager"); Players = objetoconscript.GetComponent <HeroesInstanceManager>(); name1 = Players.playerOne.name; name2 = Players.playerTwo.name; if (!playerTwo) { for (int i = 0; i < icons.Length; i++) { if (name1 == "ZAERA_RIGGEADO") { icons[i].SetActive(false); icons[0].SetActive(true); } if (name1 == "BONSITO_RIGGEADO 1") { icons[i].SetActive(false); icons[1].SetActive(true); } if (name1 == "Panda BAMBU 1") { icons[i].SetActive(false); icons[2].SetActive(true); } if (name1 == "LOBO RAGNA 1") { icons[i].SetActive(false); icons[3].SetActive(true); } } } else { for (int i = 0; i < icons.Length; i++) { if (name2 == "ZAERA_RIGGEADO") { icons[i].SetActive(false); icons[0].SetActive(true); } if (name2 == "BONSITO_RIGGEADO 1") { icons[i].SetActive(false); icons[1].SetActive(true); } if (name2 == "Panda BAMBU 1") { icons[i].SetActive(false); icons[2].SetActive(true); } if (name2 == "LOBO RAGNA 1") { icons[i].SetActive(false); icons[3].SetActive(true); } } } }