public void EnableScript(playerReference _fighter) { enabled = true; _counter.enabled = true; entity = _fighter; _pFighter = _fighter.reference.transform.GetComponent <PlayerFighter>(); isStarted = true; }
GameObject SpawnPlayer(GameObject prefab, int id, Color color) { GameObject nPlayer = Instantiate(prefab, transform.position, Quaternion.identity) as GameObject; PlayerHandler pHandler = nPlayer.GetComponent <PlayerHandler>(); pHandler.Setup(id, color); pHandler.OnDeath += PlayerDead; playerReference newPlayer = new playerReference(); newPlayer.reference = nPlayer; newPlayer.lifeRemaining = nbLife; lifeRemaining.Add(("Player" + id), newPlayer); if (OnPlayerSpawn != null) { OnPlayerSpawn(nPlayer); } return(nPlayer); }