public void useSkill(Skill a, GameObject user) { Debug.Log(a.skillName); Debug.Log(string.Format("range is {0}", a.range)); SL = GameObject.Find("gameHandler").GetComponent <skillList>(); SL.useSkill(a, user); }
// Start is called before the first frame update void Start() { availablePoint = 10; gridLayout = transform.parent.GetComponentInParent <GridLayout>(); CS = GetComponent <CharacterStats>(); Debug.Log(string.Format("{0} is coming", CS.characterName)); //find everything apText = GameObject.Find("Text").GetComponent <Text>(); map = GameObject.Find("generateMap").GetComponent <tilegenerate>(); rMap = GameObject.Find("routeMap").GetComponent <Tilemap>(); GH = GameObject.Find("gameHandler").GetComponent <gameHandler>(); SL = GameObject.Find("gameHandler").GetComponent <skillList>(); heartbar = GameObject.Find("heart"); //placing x and y to initial point in formation and check availability width = map.tmpSize.x; height = map.tmpSize.y; //cellPosition = new Vector3Int(y,x, 0); //placing character(should be written at generate player) //transform.position = gridLayout.CellToWorld(cellPosition); map.updateFog(); }
void Start() { turnNum = 0; roundNum = 1; restartButton = GameObject.Find("Button").GetComponent <Button>(); restartButton.onClick.AddListener(next); GP = GameObject.Find("generatePlayer").GetComponent <generatePlayer>(); roundText = GameObject.Find("Round").GetComponent <Text>(); turnText = GameObject.Find("Turns").GetComponent <Text>(); hpText = GameObject.Find("HP").GetComponent <Text>(); turnPlayer = GameObject.Find("Image").GetComponent <Image>(); Fire = GameObject.Find("Fire").GetComponent <Text>(); Water = GameObject.Find("Water").GetComponent <Text>(); Air = GameObject.Find("Air").GetComponent <Text>(); Plant = GameObject.Find("Plant").GetComponent <Text>(); Soul = GameObject.Find("Soul").GetComponent <Text>(); Ground = GameObject.Find("Ground").GetComponent <Text>(); Canvas = GameObject.Find("Canvas"); SL = GetComponent <skillList>(); players = GP.players; Rank(); speedrank[0].GetComponent <characterControl>().urTurn = true; turnText.text = string.Format("{0} turns", speedrank[0].GetComponent <CharacterStats>().characterName); hpText.text = string.Format("{0}/{1}", speedrank[0].GetComponent <CharacterStats>().hpLeft, speedrank[0].GetComponent <CharacterStats>().hp); Fire.text = string.Format("Fire {0}", speedrank[0].GetComponent <CharacterStats>().fire); Water.text = string.Format("Water {0}", speedrank[0].GetComponent <CharacterStats>().water); Ground.text = string.Format("Ground {0}", speedrank[0].GetComponent <CharacterStats>().ground); Soul.text = string.Format("Soul {0}", speedrank[0].GetComponent <CharacterStats>().soul); Plant.text = string.Format("Plant {0}", speedrank[0].GetComponent <CharacterStats>().plant); Air.text = string.Format("Air {0}", speedrank[0].GetComponent <CharacterStats>().air); turnPlayer.sprite = speedrank[0].GetComponent <CharacterStats>().sprite; //initialize skill list for (int i = 0; i < speedrank[0].GetComponent <CharacterStats>().skilllist.Count; i++) { Vector3 newPos = new Vector3(0.75f * i, 0, 0); var newSkillButton = Instantiate(buttonPrefab, Canvas.transform); //newSkillButton.transform.position = newPos; newSkillButton.transform.Translate(newPos); Skill a = speedrank[0].GetComponent <CharacterStats>().skilllist[i]; newSkillButton.GetComponentInChildren <Text>().text = a.skillName; Debug.Log(string.Format("range is {0}", a.range)); buttonList.Add(newSkillButton); newSkillButton.GetComponent <Button>().onClick.AddListener(delegate { useSkill(a, speedrank[0]); }); newSkillButton.GetComponent <Button>().onClick.AddListener(delegate { speedrank[0].GetComponent <characterControl>().resetControl(); }); } }