Exemple #1
0
    // Constructor for a character
    public Character(string characterName)
    {
        this.name     = characterName;
        this.progress = new CharacterProgress();

        TextAsset jsonTextFile = Resources.Load <TextAsset>(name);

        this.vars = JsonUtility.FromJson <CharacterVars>(jsonTextFile.ToString());
        readDialogue(vars.dialoguePath);
        readPostImages(vars.postImagePath);

        this.hasntMet = true;

        this.badOptions         = 0;
        this.badOptionThreshold = 5;
    }
Exemple #2
0
        protected void Awake()

        {
            charVars           = GetComponent <CharacterVars> ();
            nextPerceptions    = new List <Perception> ();
            currentPerceptions = new List <Perception> ();
            triggerList        = new List <Collider> ();

            bar = Instantiate(BarBrefab);
            bar.transform.SetParent(GameObject.FindWithTag("Canvas").transform);
            bar.GetComponent <EnemyHealth> ().target = this.gameObject;
            bar.GetComponent <Slider> ().maxValue    = charVars.maxHealth;

            col          = GetComponent <SphereCollider> ();
            fov          = charVars.FoVAngle;
            hearingRange = charVars.HearingRange;

            InvokeRepeating("DecideAction", 2f, 2f);
        }