Пример #1
0
    // Use this for initialization
    void Start()
    {
        movement = gameObject.GetComponent <Movement>();
        stats    = new Stats();
        prof     = new ProfessionScript(1, stats);
        health   = new HealthScript(stats.StatsList["Toughness"], 1, prof.assignedProfession);

        npcNeeds = new NPCNeeds(prof.assignedProfession, stats);
    }
Пример #2
0
    // Pick a profession from allowed jobs and create a child object with that job script.
    // It's done this way because there isn't really a good way to actually copy a new component at runtime (by default, Unity passes by reference).
    protected void GetJob()
    {
        int i = Random.Range(0, allowedJobsPrefabs.Length);

        myJob = Instantiate(allowedJobsPrefabs[i], transform).GetComponent <ProfessionScript>();
    }