void ResetPlayers(int playerLost)
    {
        Player1.transform.position = player1Start;
        player1View.rotation       = player1StartRot;
        Player2.transform.position = player2Start;
        player2View.rotation       = player2StartRot;

        Player_Abilities p1 = Player1.GetComponent <Player_Abilities>();

        p1.StopAllCoroutines();
        p1.ballHeld = false;
        p1.cooldown = false;
        Player_Abilities p2 = Player2.GetComponent <Player_Abilities>();

        p2.StopAllCoroutines();
        p2.ballHeld = false;
        p2.cooldown = false;

        if (playerLost == 1)
        {
            Ball.GameBall.transform.position = Player1.transform.position + (player1View.forward * 5);
            Ball.GameBall.transform.position = new Vector3(Ball.GameBall.transform.position.x, ballStartY, Ball.GameBall.transform.position.z);
            Ball.instance.lastPlayer         = Player1;
        }
        else
        {
            Ball.GameBall.transform.position = Player2.transform.position + (player2View.forward * 5);
            Ball.GameBall.transform.position = new Vector3(Ball.GameBall.transform.position.x, ballStartY, Ball.GameBall.transform.position.z);
            Ball.instance.lastPlayer         = Player2;
        }

        Ball.instance.speed                = Ball.instance.baseSpeed;
        Ball.instance.body.velocity        = Vector3.zero;
        Ball.GameBall.transform.localScale = Vector3.one;
    }
Esempio n. 2
0
    private IEnumerator Run(Block_DataModel matchedtxdata)
    {
        GameObject[] Players  = GameObject.FindGameObjectsWithTag("Player"); //find all players currently spawned in server
        float        waitTime = 0f;

        Debug.Log("uwu1");
        foreach (GameObject player in Players)
        {
            if (matchedtxdata.from.Equals(player.name, StringComparison.InvariantCultureIgnoreCase)) //if player name(address) is equal to from value in  matched txdata.
            {
                Debug.Log("uwu");
                Player_Abilities player_abilities = player.GetComponent <Player_Abilities>(); //get player properties script of this player.
                SetAbilityAcctotx(matchedtxdata, player_abilities);                           //transfer matched tx + its specific player ability script to combine.
            }
            yield return(new WaitForSeconds(waitTime));
        }
    }
Esempio n. 3
0
    void SetAbilityAcctotx(Block_DataModel matchedtxdata, Player_Abilities player_abilities)
    {
        //DEBUG : enable ability for this player /////////// DEBUG
        Debug.Log("Debug_PlayerAbility with Tx:");
        Debug.Log(matchedtxdata.from);
        ////////////////////////////////////////////////////////



        player_abilities.address = matchedtxdata.from;

        decimal abilityvalue = decimal.Parse(matchedtxdata.value);

        abilityvalue = abilityvalue / 1000000000000000000; // Wei to ether

        float f_abilityvalue = (float)abilityvalue;        //changing decimal to float : optimatize

        if (f_abilityvalue > 1)
        {
            f_abilityvalue = 1;
        }                                               //Max 1 Ether only ability, efn Whale Proof!
        f_abilityvalue *= 100;                          //1ether = 100 ability
        player_abilities.abilityvalue = f_abilityvalue; //ablityvalue acc to tx value.
    }