Ejemplo n.º 1
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);
        }
    }