コード例 #1
0
ファイル: tilegenerate.cs プロジェクト: BonnyWang/V1
 public void Start()
 {
     //restartButton.onClick.AddListener(again);
     GP      = GameObject.Find("generatePlayer").GetComponent <generatePlayer>();
     players = GP.players;
     again();
 }
コード例 #2
0
ファイル: gameHandler.cs プロジェクト: BonnyWang/V1
    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(); });
        }
    }