Ejemplo n.º 1
0
    void UpdateUI()
    {
        curr_char    = turnOrder.GetCurrent();
        curCharacter = turnOrder.GetCurrent().GetComponent <Stats>();
        if (!curCharacter)
        {
            Debug.LogError("Failed to get stats component from current head of turn from TurnOrder script");
        }
        uiScript.SetupUI(curCharacter);
        SkillTreeScript skills = curCharacter.GetComponent <SkillTreeScript>();

        skills.StartTurn();
        curCharActions = skills.numActions + skills.numMoves;
        uiScript.SetupActions(skills);
        uiScript.SetTurnUI("Turn " + turnCounter);
        if (!clicker)
        {
            clicker = FindObjectOfType <Clicker>();
        }
        clicker.CloseTiles();
        if (curCharacter.tag == "Enemy")
        {
            curCharacter.gameObject.GetComponent <EnemyAIMaster>().NextTurn();
        }
    }
Ejemplo n.º 2
0
    void Awake()
    {
        effects = new UnityAction[5, 3] {
            { Skill1Effect, Skill1Effect, Skill1Effect }, { MeleeAbilityEffect, SpeedAbilityEffect, ManaAbilityEffect }, { Melee1Effect, Speed1Effect, Mana1Effect }, { Melee2Effect, Speed2Effect, Mana2Effect }, { Melee3Effect, Speed3Effect, Mana3Effect }
        };
        stuffs = PermVar.current.choices;
        sts    = this;
        //resetButton = transform.parent.Find("Reset Skill Tree").gameObject;
        //prices[0] = { { 1 } };//, { 5, 5, 5 }, { 15, 15, 15 }, { 45, 45, 45 }, { 135, 135, 135 } };
        //tempShade = PermVar.current.Shade + PlayerClass.main.curShade;
        st = transform;
        transform.Find("Skill 1").GetComponent <Button>().onClick.AddListener(Skill1);
        transform.Find("Melee Ability").GetComponent <Button>().onClick.AddListener(MeleeAbilityClick);
        transform.Find("Melee 1").GetComponent <Button>().onClick.AddListener(Melee1);
        transform.Find("Melee 2").GetComponent <Button>().onClick.AddListener(Melee2);
        transform.Find("Melee 3").GetComponent <Button>().onClick.AddListener(Melee3);
        transform.Find("Speed Ability").GetComponent <Button>().onClick.AddListener(SpeedAbilityClick);
        transform.Find("Speed 1").GetComponent <Button>().onClick.AddListener(Speed1);
        transform.Find("Speed 2").GetComponent <Button>().onClick.AddListener(Speed2);
        transform.Find("Speed 3").GetComponent <Button>().onClick.AddListener(Speed3);
        transform.Find("Mana Ability").GetComponent <Button>().onClick.AddListener(ManaAbilityClick);
        transform.Find("Mana 1").GetComponent <Button>().onClick.AddListener(Mana1);
        transform.Find("Mana 2").GetComponent <Button>().onClick.AddListener(Mana2);
        transform.Find("Mana 3").GetComponent <Button>().onClick.AddListener(Mana3);
        //Debug.Log("this happened");
        resetButton = transform.parent.Find("Reset Skill Tree").gameObject;
        resetButton.SetActive(false);
        //Debug.Log("it was disabled");

        resetButton.GetComponent <Button>().onClick.AddListener(resetChoices);
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        stats          = GetComponent <Stats>();
        playerCharList = new List <GameObject>();
        skillTree      = GetComponent <SkillTreeScript>();
        GameObject[] p        = GameObject.FindGameObjectsWithTag("Ally");
        float        distance = float.MaxValue;

        foreach (var item in p)
        {
            playerCharList.Add(item);
            float tempDis = Vector3.Distance(item.transform.position, transform.position);
            if (tempDis < distance)
            {
                distance = tempDis;
                target   = item;
            }
        }
        gmc = GetComponent <GridMovementController>();
        bg  = FindObjectOfType <BoardGenerator>();
    }
Ejemplo n.º 4
0
 public void SetupActions(SkillTreeScript skills)
 {
     for (int i = 0; i < skillSlots.transform.childCount; i++)
     {
         skillSlots.transform.GetChild(i).gameObject.GetComponent <Image>().sprite = null;
     }
     for (int i = 0; i < skills.skills.Count; i++)
     {
         //Setup on click event to run the skill functionality
         GameObject child     = skillSlots.transform.GetChild(i).gameObject;
         Button     buttonRef = child.GetComponent <Button>();
         buttonRef.onClick.RemoveAllListeners();
         buttonRef.onClick.AddListener(skills.skills[i].Execute);
         skillSlots.transform.GetChild(i).GetComponent <Image>().sprite = skills.skills[i].actionImage;
         if (skillSlots.transform.GetChild(i).GetComponent <Image>().sprite == null)
         {
             skillSlots.transform.GetChild(i).gameObject.SetActive(false);
         }
         else
         {
             skillSlots.transform.GetChild(i).gameObject.SetActive(true);
         }
     }
 }