Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag.Equals("Candy"))
        {
            Candy candy  = (Candy)col.gameObject.GetComponent <Candy>();
            int   points = candy.GetCandyPoint();

            myPlayerInfo.localCharacterScore  += points;
            myPlayerInfo.globalCharacterScore += points;

            //int local = myPlayerInfo.localCharacterScore;
            //int global = myPlayerInfo.globalCharacterScore;
            //myPlayerInfo.IncrementScore(local, global);

            //Network.Destroy(col.gameObject.GetComponent<NetworkIdentity>().netId);

            if (isServer)
            {
                NetworkServer.Destroy(candy.gameObject);
            }
            else
            {
                CmdDestroyCandy(candy.GetComponent <NetworkIdentity>().assetId);
            }

            if (floatingText)
            {
                ShowFloatingText(points);
            }
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag.Equals("Candy"))
        {
            Candy candy  = (Candy)col.gameObject.GetComponent <Candy>();
            int   points = candy.GetCandyPoint();

            myPlayerInfo.localCharacterScore  += points;
            myPlayerInfo.globalCharacterScore += points;

            //int local = myPlayerInfo.localCharacterScore;
            //int global = myPlayerInfo.globalCharacterScore;
            //myPlayerInfo.IncrementScore(local, global);

            DestroyCandy(col.gameObject);
            if (floatingText)
            {
                ShowFloatingText(points);
            }
        }
    }