Esempio n. 1
0
    // This function creates the various NCP's by getting the GameObject returned by the NPC_Factory class
    public void SpawnVillagers()
    {
        // Sets the NPC GameObjects created in the NPC_Factory class to the NPC instances created above
        m_Beggar = (Beggars)m_Factory.GetNPC(NPCType.Beggar);
        m_Beggar.transform.Translate(Vector3.forward * incAll * 1.5f);

        m_Shop_Owner = (Shop_Owners)m_Factory.GetNPC(NPCType.Shop_Owner);
        m_Shop_Owner.transform.Translate(Vector3.forward * incAll * 1.5f);

        m_Farmer = (Farmers)m_Factory.GetNPC(NPCType.Farmer);
        m_Farmer.transform.Translate(Vector3.forward * incAll * 1.5f);

        m_Small_Egg = (Small_Eggs)m_Factory.GetNPC(NPCType.Small_egg);
        m_Small_Egg.transform.Translate(Vector3.forward * incAll * 1.5f);

        incAll++;
    }
Esempio n. 2
0
    // Called on startup
    void Start()
    {
        // Instantiates the corresponding objects(beggar, egg, etc) by finding the corresponding prefab within the resources folder
        GameObject beg_obj = Instantiate(Resources.Load("Prefabs_2/Beggar")) as GameObject;

        m_beg = beg_obj.GetComponent <Beggars>();

        GameObject farm_obj = Instantiate(Resources.Load("Prefabs_2/Farmer")) as GameObject;

        m_farm = farm_obj.GetComponent <Farmers>();

        GameObject shop_owner_obj = Instantiate(Resources.Load("Prefabs_2/Shop_Owner")) as GameObject;

        m_shop_owner = shop_owner_obj.GetComponent <Shop_Owners>();

        GameObject small_egg_obj = Instantiate(Resources.Load("Prefabs_2/Small_Egg")) as GameObject;

        m_small_egg = small_egg_obj.GetComponent <Small_Eggs>();
    }