Beispiel #1
0
    // Create the initial NPC
    public void init(Building h, Building w)
    {
        // Decide where the npc works and lives
        home = h;
        work = w;
        home.owners.Add(this);
        work.owners.Add(this);

        // Create a random sprite and initialize it
        sprite = GetComponent <npcSprite>();
        sprite.init();
        fillInventoy();

        // Create a random state and personality for the npc
        initState();
        initPersonality();
        sprite.placeAt(new Vector3(tileX, tileY, 0));
        sprite.undraw();

        // How fast the NPC moves
        if (personality == Personality.lazy)
        {
            movementSpeed = Random.Range(1.0f, 1.5f);
        }
        else
        {
            movementSpeed = Random.Range(0.5f, 1.0f);
        }
    }
Beispiel #2
0
    // Create the initial NPC
    public void init(Building h, Building w, int ID)
    {
        // Decide where the npc works and lives
        home     = h;
        work     = w;
        homeTile = home.loc;
        workTile = work.loc;
        this.ID  = ID;
        home.owners.Add(this);
        work.owners.Add(this);

        // Create a random sprite and initialize it
        sprite = GetComponent <npcSprite>();
        sprite.init();
        sprite.textbox = textbox;

        // Create a random state and personality for the npc
        initState();
        initPersonality();

        // We're done with the sprite for now
        sprite.placeAt(new Vector3(tileX, tileY, 0));
        sprite.undraw();

        // How fast the NPC moves initially
        if (personality == "lazy")
        {
            movementSpeed = Random.Range(1.5f, 2.0f);
        }
        else
        {
            movementSpeed = Random.Range(0.5f, 1.0f);
        }
    }
Beispiel #3
0
 // Removes the npc from the screen
 public void undraw()
 {
     sprite.undraw();
     if (hasQuest)
     {
         quest.SetActive(false);
     }
 }