// Use this for initialization
    void Start()
    {
        // References to objects and componenets
        pmObj = GameObject.Find("PlayerManager");
        if (pmObj)
        {
            pm = pmObj.GetComponent <PlayerManager> ();
        }
        if (pmObj == null)
        {
            Debug.Log("ERROR - Cannot find player manager object in scene");
        }
        if (pm == null)
        {
            Debug.Log("ERROR - Cannot find player manager component in scene");
        }


        classDatabaseObj = GameObject.Find("CharacterClassManager");
        if (classDatabaseObj)
        {
            classDatabase = classDatabaseObj.GetComponent <ClassDatabase> ();
        }
        if (classDatabaseObj == null)
        {
            Debug.Log("Cannot find class database object in character selection scene");
        }
        if (classDatabase == null)
        {
            Debug.Log("Cannot find class database component in character selection scene");
        }

        currentClass = classDatabase.GetClass(currentIndex);
        DisplayStat();
    }
Beispiel #2
0
    protected override void Awake()
    {
        base.Awake();

        health    = 10;
        armor     = 5;
        strength  = 0;
        magic     = 0;
        dexterity = 0;
        score     = 0;

        //maxAuras = 12;

        primaryStats = new StatType[2];
        otherStats   = new StatType[2];

        var settingsObj = GameObject.FindGameObjectWithTag("SettingsManager");

        if (settingsObj != null)
        {
            var settings = settingsObj.GetComponent <SettingsManager>();
            primaryStats[0] = settings.primaryStat;
            primaryStats[1] = settings.offStat;

            var offStats = StatTypes.GetOtherStats(primaryStats);
            otherStats[0] = offStats[0];
            otherStats[1] = offStats[1];
        }
        else
        {
            primaryStats[0] = StatType.Strength;
            otherStats[0]   = StatType.Dexterity;
            otherStats[1]   = StatType.Magic;
        }

        data.type = Entity.Type.Player;

        hand      = new CardInfo[5];
        deck      = new ArrayList();
        graveyard = new ArrayList();

        // Player will always have punch in hand[4]
        // Punch doesn't go into graveyard when used and can't be discarded
        hand[punchIndex] = punchCard;

        selectedCard = punchIndex;

        // Put class' special card in hand
        CardInfo specialCard = ClassDatabase.GetClass(primaryStats[0], primaryStats[1]).specialCard;

        if (specialCard)
        {
            PutCardInHand(specialCard);
        }
    }
    public void UpdateClassDescription()
    {
        var settings = SettingsManager.GetScript;
        var cClass   = ClassDatabase.GetClass(settings.primaryStat, settings.offStat);

        classSprite.sprite  = cClass.sprite;
        classNameText.text  = cClass.className;
        classStatsText.text = cClass.primaryStat + "/" + cClass.offStat;
        classDescText.text  = cClass.description;
        classSignatureCard.SetItem(cClass.specialCard);
    }