Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (Tank.isPlayer(gameObject))
        {
            if (other.gameObject.CompareTag("shild"))
            {
                PhotonNetwork.Destroy(other.gameObject);
                Debug.Log("Shield Collected");
                shildUp = true;
                FloatyText.Make(prefab_floatyText, "+Shield", other.transform.position);
            }

            if (other.gameObject.CompareTag("health"))
            {
                PhotonNetwork.Destroy(other.gameObject);
                Debug.Log("Meds Collected");
                healthUp = true;
                FloatyText.Make(prefab_floatyText, "+Health", other.transform.position);
            }

            if (other.gameObject.CompareTag("ammo"))
            {
                PhotonNetwork.Destroy(other.gameObject);
                Debug.Log("Ammo Collected");
                ammoUp = true;
                FloatyText.Make(prefab_floatyText, "+Ammo", other.transform.position);
            }
        }
    }
Beispiel #2
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();
        }
    }
Beispiel #3
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();
        }
    }
Beispiel #4
0
    public static FloatyText Make(FloatyText prefab, string text, Vector3 pos)
    {
        FloatyText ft = Instantiate(prefab.gameObject).GetComponent <FloatyText>();

        ft.transform.position = pos;
        ft.Text = text;
        return(ft);
    }
Beispiel #5
0
    private void CreateFailureText(Tile tileFinal, int value)
    {
        FloatyText newFloatyText = Instantiate(prefab_FloatyTextFailure, tileFinal.transform.position, Quaternion.identity).GetComponent <FloatyText>();

        newFloatyText.SetText(value.ToString(), BetterColor.pinkLight);
    }