Esempio n. 1
0
    void Update()
    {
        if (RB.position.x < 0)
        {
            Left = true;
        }
        else
        {
            Left = false;
        }

        // If we are controlling this paddle, have an ability, and our player is trying to use it:
        if (isLocalPlayer && HasAbility() && GetInput.ButtonDown("Ability"))
        {
            // Tell the server we want to use our ability.
            CmdUseAbility();
        }

        // If we are controlling this paddle, have an ability, and our player is trying to use it:
        if (isLocalPlayer && GetInput.ButtonDown("Switch Team"))
        {
            // Tell the server we want to switch team.
            CmdSwitchTeam();
        }

        // If we are the server, the paddle has an active ability, and the ability should end:
        if (isServer && HasActiveAbility() && Time.time > AbilityEnd)
        {
            // Tell all clients we should end the ability.
            RpcEndAbility(ActiveAbility);
        }
    }
Esempio n. 2
0
 [ServerCallback] // Only run on server.
 void Update()
 {
     if (GetInput.ButtonDown("Reset"))
     {
         Left  = 0;
         Right = 0;
     }
 }