public void Spawn(Vector3 pos) { Debug.Log("Entra"); //instanciael objeto en e la posicion actual asignandole el playerAsset GameObject gameobject = (GameObject)UnityEngine.Object.Instantiate(this._playerAsset, pos, Quaternion.identity); //Sele asigna a componente la clase CPlayerNew por si este no a sido cargado CPlayerNew component = gameObject.GetComponent <CPlayerNew>(); //Se agrega el elemento a la lista de players this._PlayerList.Add(component); //Actualiza el indise a la hora de crearlo en la lista component.SubscribeOnInst(new CPlayerNew.PlayerSpawn(this.OnUpdatePlayerIndex)); }
//Actalizar el indixe de la lista de players private void OnUpdatePlayerIndex(CPlayerNew player) { int index = this._PlayerList.IndexOf(player); this._index = index; }
private void Awake() { this._inst = this; this._PlayerManager = GetComponent <CPlayerManagerNew>(); this._Fire = GetComponent <CFireNew>(); }