Esempio n. 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);
        }
    }
Esempio n. 2
0
    // Writes the given text strings to the screen
    public void WriteAll(List <string> t, npcSprite npc)
    {
        if (Time.time - timeLoc < textSpeed)
        {
            queue.Add(new Message(t, npc));
            return;
        }

        if (sprite != null)
        {
            sprite.undrawZoom();
        }
        if (npc == null)
        {
            sprite = null;
        }
        else
        {
            sprite = npc;
            sprite.drawZoom();
        }

        mesh.text  = "";
        text       = t;
        textScroll = 0;
        timeLoc    = Time.time;

        // Write out all of the text
        for (int i = 0; i < t.Count; i++)
        {
            mesh.text += t[i] + "\n";
        }
    }
Esempio n. 3
0
    // Writes the given text to the screen
    public void Write(string t, npcSprite npc)
    {
        if (Time.time - timeLoc < textSpeed)
        {
            queue.Add(new Message(t, npc));
            return;
        }

        if (sprite != null)
        {
            sprite.undrawZoom();
        }
        if (npc == null)
        {
            sprite = null;
        }
        else
        {
            sprite = npc;
            sprite.drawZoom();
        }

        text.Clear();
        text.Add(t);
        textScroll = 0;
        timeLoc    = Time.time;
        mesh.text  = t;
    }
Esempio n. 4
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);
        }
    }
Esempio n. 5
0
 public Message(List<string> t, npcSprite s)
 {
     text = t;
     sprite = s;
 }
Esempio n. 6
0
 public Message(string t, npcSprite s)
 {
     text = new List<string>();
     text.Add(t);
     sprite = s;
 }
Esempio n. 7
0
    // Writes the given text strings to the screen
    public void WriteAll(List<string> t, npcSprite npc = null, bool doNow = true)
    {
        if (npc != null && !doNow && Time.time - timeLoc < textSpeed)
        {
            queue.Add(new Message(t, npc));
            return;
        }

        if (sprite != null)
            sprite.undrawZoom();
        if (npc == null)
            sprite = null;
        else
        {
            sprite = npc;
            sprite.drawZoom();
        }

        mesh.text = "";
        text = t;
        textScroll = 0;
        timeLoc = Time.time;

        // Write out all of the text
        for (int i = 0; i < t.Count; i++)
            mesh.text += t[i] + "\n";
    }
Esempio n. 8
0
    // Writes the given text to the screen
    public void Write(string t, npcSprite npc = null, bool doNow = true)
    {
        if (npc != null && !doNow && Time.time - timeLoc < textSpeed)
        {
            queue.Add(new Message(t, npc));
            return;
        }

        if (sprite != null)
            sprite.undrawZoom();
        if (npc == null)
            sprite = null;
        else
        {
            sprite = npc;
            sprite.drawZoom();
        }

        text.Clear();
        text.Add(t);
        textScroll = 0;
        timeLoc = Time.time;
        mesh.text = t;
    }
Esempio n. 9
0
 public Message(List <string> t, npcSprite s)
 {
     text   = t;
     sprite = s;
 }
Esempio n. 10
0
 public Message(string t, npcSprite s)
 {
     text = new List <string>();
     text.Add(t);
     sprite = s;
 }