public void SetNewCharacter(int idc, string name, string c, Vector3 charCoor) { Character chara = characterPrefab.GetComponent <Character> (); GameboardControl gb = gameObject.GetComponent <GameboardControl> (); chara.SetCharacter(c, idc, charCoor, name); gb.AddInCharacters(idc); }
// Start is called before the first frame update void Start() { _controller = GetComponent <CharacterController> (); gameboard = GameObject.FindGameObjectWithTag("GameBoard").GetComponent <GameboardControl> (); isAttacking = false; player = gameObject.GetComponent <Character> (); buttonClicked = false; }
public void AddDoor(GameObject w) { GameObject doorObject = Instantiate(doorPrefab, w.transform.localPosition, Quaternion.identity); doorObject.transform.Rotate(w.transform.rotation.eulerAngles); doorObject.transform.SetParent(gameObject.transform, false); GameboardControl gb = GameObject.FindGameObjectWithTag("GameBoard").GetComponent <GameboardControl> (); doors.Add(doorObject); }
public void SetUI(GameboardControl gameboard) { for (int i = 0; i < slots.Length; i++) { if (i < gameboard.GetCMax()) { slots[i].AddPlayer(gameboard.GetCharacter(i)); } else { slots[i].ClearSlot(); } } }
public Tile AddTile(int id, int c, int r, float size, int mazeRows) { //Tile Spawning GameboardControl gb = GetComponent <GameboardControl> (); GameObject tileObject = Instantiate(tilePrefab, new Vector3(c * size, 0, r * size), Quaternion.identity); tileObject.transform.SetParent(gameObject.transform, false); string name = "Tile" + c + "," + r; tileObject.name = name; Tile tile = tileObject.GetComponent <Tile> (); //Walls Spawning if (c == 0) { GameObject westWall = Instantiate(wallPrefab, new Vector3(-4 / size, 3, 0), Quaternion.identity) as GameObject; westWall.name = "West Wall " + c + "," + r; westWall.transform.SetParent(tileObject.transform, false); tile.SetWestWall(westWall); } GameObject eastWall = Instantiate(wallPrefab, new Vector3(4 / size, 3, 0), Quaternion.identity) as GameObject; eastWall.name = "East Wall " + c + "," + r; eastWall.transform.SetParent(tileObject.transform, false); tile.SetEastWall(eastWall); if (r == mazeRows - 1) { GameObject northWall = Instantiate(wallPrefab, new Vector3(0, 3, 4 / size), Quaternion.identity) as GameObject; northWall.name = "North Wall " + c + "," + r; northWall.transform.Rotate(new Vector3(0, 90, 0)); northWall.transform.SetParent(tileObject.transform, false); tile.SetNorthWall(northWall); } GameObject southWall = Instantiate(wallPrefab, new Vector3(0, 3, -4 / size), Quaternion.identity) as GameObject; southWall.name = "South Wall " + c + "," + r; southWall.transform.Rotate(new Vector3(0, 90, 0)); southWall.transform.SetParent(tileObject.transform, false); tile.SetSouthWall(southWall); tile.SetTile(new Vector3(c, 0, r)); return(tile); }
public void Start() { paused = false; cMax = Parameters.cMax; hoverPanel.SetActive(false); buffsUI.SetActive(false); playersUI.SetActive(false); statsUI.SetActive(false); abilitiesUI.SetActive(false); itemsUI.SetActive(false); popupUI.SetActive(false); endGameUI.SetActive(false); pauseUI.SetActive(false); cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController> (); GameObject gameBoardObject = Instantiate(gameBoardPrefab, new Vector3(0, 0, 0), Quaternion.identity); gameBoard = gameBoardObject.GetComponent <GameboardControl> (); gameBoard.StartingGame(cMax, Parameters.columns, Parameters.rows); }
public void SetUI(GameboardControl gameboard) { transform.GetChild(1).GetComponent <TMPro.TMP_Text> ().text = gameboard.GetAliveCharacter().GetName() + " is the winner!"; }
public void ActivateHap(Character p) { if (idH == 0) { string stat = null; int diceRoll2 = Random.Range(0, 6); if (diceRoll2 == 0) { stat = "Mouvement"; p.SetMouvement(diceRoll - p.GetMouvement()); } else if (diceRoll2 == 1) { stat = "Maximum Health"; p.SetMaxHealth(diceRoll - p.GetMaxHealth()); if (p.GetMaxHealth() < p.GetHealth()) { p.SetHealth(p.GetMaxHealth() - p.GetHealth()); } } else if (diceRoll2 == 2) { stat = "Strength"; p.SetStrength(diceRoll - p.GetStrength()); } else if (diceRoll2 == 3) { stat = "Agility"; p.SetAgility(diceRoll - p.GetAgility()); } else if (diceRoll2 == 4) { stat = "Intelligence"; p.SetIntelligence(diceRoll - p.GetIntelligence()); } else { stat = "Wisdom"; p.SetWisdom(diceRoll - p.GetWisdom()); } description = "Your " + stat + " has been set to " + diceRoll + "."; } else if (idH == 1) { if (diceRoll < 4) { p.SetHealth(diceRoll); if (p.GetHealth() > p.GetMaxHealth()) { p.SetHealth(p.GetMaxHealth() - p.GetHealth()); } description = "You won the bet, you gain " + diceRoll + " HP."; } else { int d = diceRoll - 2; p.SetHealth(-d); description = "You lost the bet, you lost " + d + " HP."; } } else if (idH == 2) { if (diceRoll < 4) { p.SetHealth(-diceRoll); description = "You lost the bet, you lost " + diceRoll + " HP."; } else { GameboardControl gb = GameObject.FindWithTag("GameBoard").GetComponent <GameboardControl> (); foreach (Character c in gb.GetCharacters()) { if (c.GetId() != p.GetId()) { c.SetHealth(-1); } } description = "You won the bet, everyone else loses 1 Hp."; } } else if (idH == 3) { UIController uiC = GameObject.Find("Canvas").GetComponent <UIController> (); uiC.SetLevelUpButtons(); description = "You gain a level."; } }