Beispiel #1
0
    //Find the model, and do any setup to reflect it
    public void InitModel()
    {
        mod = GetComponent <Chr>();
        mod.Start();

        //TODO:: Consider if we want to set up an observer for this
        //        May not need to since a Chr likely won't exist without some sort of View.

        mod.subFatigueChange.Subscribe(cbUpdateFatigue);
        mod.subLifeChange.Subscribe(cbUpdateLife);
        mod.pnMaxHealth.subChanged.Subscribe(cbUpdateLife);
        mod.subStatusChange.Subscribe(cbUpdateStatus);
        mod.pnArmour.subChanged.Subscribe(cbUpdateArmour);
        mod.pnPower.subChanged.Subscribe(cbUpdatePower);
        mod.pnDefense.subChanged.Subscribe(cbUpdateDefense);
        mod.subChannelTimeChange.Subscribe(cbUpdateChannelTime);
        mod.subDeath.Subscribe(cbUpdateDeath);
        mod.subPreExecuteSkill.Subscribe(cbStartUsingSkill);
        mod.subPostExecuteSkill.Subscribe(cbStopUsingSkill);

        mod.subLifeChange.Subscribe(cbRecoil);
        mod.subSoulApplied.Subscribe(cbSoulApplied);
        mod.subStunApplied.Subscribe(cbRecoil);
        mod.subLifeChange.Subscribe(cbOnInjured);

        mod.subBecomesActiveForHumans.Subscribe(cbOnBecomesActiveForHumans);
        mod.subEndsActiveForHumans.Subscribe(cbOnEndsActiveForHumans);
        mod.subBecomesTargettable.Subscribe(cbOnBecomesTargettable);
        mod.subEndsTargettable.Subscribe(cbOnEndsTargettable);
    }
Beispiel #2
0
    // Will eventually need a clean solution to adding/removing characters
    // while managing ids - some sort of Buffer of unused views will probably help
    void InitChr(CharType.CHARTYPE chartype, Player player, int idChar, LoadoutManager.Loadout loadout)
    {
        GameObject goChr  = Instantiate(pfChr, this.transform);
        Chr        newChr = goChr.GetComponent <Chr>();

        if (newChr == null)
        {
            Debug.LogError("ERROR! NO CHR COMPONENT ON CHR PREFAB!");
        }

        newChr.Start();

        newChr.InitChr(chartype, player, idChar, loadout);

        arChrs[player.id][idChar] = newChr;
        player.arChr[idChar]      = newChr;
    }