Exemplo n.º 1
0
    public void AddToPlayerInventory(InventoryItem ii)
    {
        Vector3  p   = ii.transform.position;
        Material mat = ii.GetComponent <Renderer>().material;

        GameClock.Delay(0, () => {         // make sure object creation happens on the main thread
            FloatyText ft        = FloatyTextManager.Create(p + (Vector3.up * game.maze.tileSize.y * game.maze.wallHeight), mat.name);
            ft.TmpText.faceColor = mat.color;
        });
        // find which NPC wants this, and make them light up
        ParticleSystem ps  = null;
        CharacterRoot  npc = game.npcCreator.npcs.Find(n => {
            ps = n.GetComponentInChildren <ParticleSystem>();
            if (ps.name == mat.name)
            {
                return(true);
            }
            ps = null;
            return(false);
        });

        if (npc != null)
        {
            ps.Play();
        }
    }
Exemplo n.º 2
0
    public void PickUp(GameObject finder)
    {
        //Show.Log(finder+" picked up "+specificName+"("+typeName+")");
        Game     game = Global.Get <Game>();
        Vector3  p    = transform.position;
        Material mat  = GetComponent <Renderer>().material;

        GameClock.Delay(0, () => {         // make sure object creation happens on the main thread
            FloatyText ft        = FloatyTextManager.Create(p + (Vector3.up * game.maze.tileSize.y * game.maze.wallHeight), kind);
            ft.TmpText.faceColor = mat.color;
        });
        // find which NPC wants this, and make them light up
        ParticleSystem ps = null;
        //Show.Log(specificName+" turns on particle for "+typeName);
        CharacterRoot npc = game.npcCreator.npcs.Find(n => {
            ps = n.GetComponentInChildren <ParticleSystem>();
            //Show.Log(ps.name + " v " + typeName);
            if (ps != null && ps.name == color)
            {
                return(true);
            }
            ps = null;
            return(false);
        });

        if (npc != null && ps != null)
        {
            ps.Play();
        }
    }