void SpawnAUnit(int UnitType, int UnitID) { if (UnitType == 0) { GameObject spawnedUnit = Instantiate(RegularUnit, new Vector3(transform.position.x, 0, transform.position.z), RegularUnit.transform.rotation) as GameObject; //Registers for tracking spawnedUnit.GetComponent <PlayerID>().ID = UnitID; spawnedUnit.GetComponent <UnitController>().PersuitStartingPosition = GeneratePoint(new Vector3(transform.position.x, 0, transform.position.z)); spawnedUnit.GetComponent <NameSync>().ObjectNameNumber = FindObjectOfType <ObjectSyncManager>().GenerateUniqueName(); NetworkServer.Spawn(spawnedUnit); } else if (UnitType == 1) { GameObject spawnedUnit = Instantiate(RapidUnit, new Vector3(transform.position.x, 0, transform.position.z), RapidUnit.transform.rotation) as GameObject; //Registers for tracking spawnedUnit.GetComponent <PlayerID>().ID = UnitID; spawnedUnit.GetComponent <UnitController>().PersuitStartingPosition = GeneratePoint(new Vector3(transform.position.x, 0, transform.position.z)); spawnedUnit.GetComponent <NameSync>().ObjectNameNumber = FindObjectOfType <ObjectSyncManager>().GenerateUniqueName(); NetworkServer.Spawn(spawnedUnit); } else if (UnitType == 2) { GameObject spawnedUnit = Instantiate(MissileUnit, new Vector3(transform.position.x, 0, transform.position.z), MissileUnit.transform.rotation) as GameObject; //Registers for tracking spawnedUnit.GetComponent <PlayerID>().ID = UnitID; spawnedUnit.GetComponent <UnitController>().PersuitStartingPosition = GeneratePoint(new Vector3(transform.position.x, 0, transform.position.z)); spawnedUnit.GetComponent <NameSync>().ObjectNameNumber = FindObjectOfType <ObjectSyncManager>().GenerateUniqueName(); NetworkServer.Spawn(spawnedUnit); } else if (UnitType == 3) { GameObject spawnedUnit = Instantiate(RailUnit, new Vector3(transform.position.x, 0, transform.position.z), RailUnit.transform.rotation) as GameObject; //Registers for tracking spawnedUnit.GetComponent <PlayerID>().ID = UnitID; spawnedUnit.GetComponent <UnitController>().PersuitStartingPosition = GeneratePoint(new Vector3(transform.position.x, 0, transform.position.z)); spawnedUnit.GetComponent <NameSync>().ObjectNameNumber = FindObjectOfType <ObjectSyncManager>().GenerateUniqueName(); NetworkServer.Spawn(spawnedUnit); } else if (UnitType == 4) { GameObject spawnedUnit = Instantiate(LaserUnit, new Vector3(transform.position.x, 0, transform.position.z), LaserUnit.transform.rotation) as GameObject; //Registers for tracking spawnedUnit.GetComponent <PlayerID>().ID = UnitID; spawnedUnit.GetComponent <UnitController>().PersuitStartingPosition = GeneratePoint(new Vector3(transform.position.x, 0, transform.position.z)); spawnedUnit.GetComponent <NameSync>().ObjectNameNumber = FindObjectOfType <ObjectSyncManager>().GenerateUniqueName(); NetworkServer.Spawn(spawnedUnit); } SpawnQueue.RemoveAt(0); }
public void addCard(int cardcode) { if (this.len() >= 5) { Debug.Log("Card Number Exceeds 5 : discarding first hand & re-spawn"); CmdSpawn(iList[0]); iList.RemoveAt(0); } iList.Add(cardcode); Rpcannounce(); Debug.Log("add" + cardcode); Debug.Log("your current hand is" + BuildList()); }
/// <summary> /// plays the ingredient card at the given index in the players hand. /// </summary> /// <param name="ind">Index of the ingredient card to play. </param> public void playIngrCard(int ind) { //Debug.Log (ind); //Debug.Log (ingCrds[ind]); //Debug.Log (GameObject.Find("Canvas/Panel Player HUD/Panel Ingredients/Button CRD1").GetComponent<Button> ().onClick.GetPersistentEventCount ()); //check if selected card exists or that adding the card won't exceed the ingredient limit if (ingCrds.Count <= ind || (sandwich.Count + 1) >= maxIngredientsAllowed) { return; } sandwich.Add(ingCrds[ind]); ingCrds.RemoveAt(ind); string tmp = ""; foreach (int i in sandwich) { tmp += i.ToString() + "|"; } tmp = tmp.Substring(0, tmp.Length - 1); CmdPlayIngredient(tmp, UID); }
public void CmdRemoveAtSyncList(int positionRemoved) { sl_Power.RemoveAt(positionRemoved); UpdateLocalList(); }
public void CmdDelPlayedEvnt(int ind) { evntCrds.RemoveAt(ind); }