Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        // For every node, make sure that it gets loaded in here!
        // All of the nodes should be attached to the same object that this script is attached to

        // Passive only
        GolfClap golfClap = GetComponent <GolfClap>();

        handlers[golfClap.skillName] = golfClap.Resolve;
        Applause applause = GetComponent <Applause>();

        handlers[applause.skillName] = applause.Resolve;
        Coach coach = GetComponent <Coach>();

        handlers[coach.skillName] = coach.Resolve;


        // Has an active
        Ghost ghost = GetComponent <Ghost>();

        handlers[ghost.skillName] = ghost.Resolve;
        Surprise surprise = GetComponent <Surprise>();

        handlers[surprise.skillName] = surprise.Resolve;
    }
Beispiel #2
0
    public void InstCaption()
    {
        Canvas canvasRef = Canvas.FindObjectOfType <Canvas>();

        instCaption = GameObject.Instantiate(captionPrefab);

        instCaption.transform.SetParent(canvasRef.transform, false);
        instCaption.transform.position = gameObject.transform.position + Vector3.up;

        Text[] captionContents = instCaption.GetComponentsInChildren <Text>();
        Text   captionTitle    = captionContents[0];

        captionTitle.text = this.abilityName;

        Text   captionText = captionContents[1];
        string cap         = "";

        GameObject skillNodes = GameObject.Find("SkillTreeNodes");

        if (skillNodes != null)
        {
            switch (this.abilityName)
            {
            case "Ghost":
                Ghost g = skillNodes.GetComponent <Ghost>();
                cap = g.skillDescription;
                break;

            case "Applause":
                Applause a = skillNodes.GetComponent <Applause>();
                cap = a.skillDescription;
                break;

            case "Coach":
                Coach c = skillNodes.GetComponent <Coach>();
                cap = c.skillDescription;
                break;

            case "Surprise":
                Surprise s = skillNodes.GetComponent <Surprise>();
                cap = s.skillDescription;
                break;

            case "Golf Clap":
                GolfClap gc = skillNodes.GetComponent <GolfClap>();
                cap = gc.skillDescription;
                break;
            }
        }
        captionText.text = cap;
    }