40 lines
768 B
C#
40 lines
768 B
C#
using UnityEngine;
|
|
|
|
namespace Oculus.Platform.Samples.VrHoops
|
|
{
|
|
public class LocalPlayer : Player
|
|
{
|
|
public override uint Score
|
|
{
|
|
set
|
|
{
|
|
base.Score = value;
|
|
if (PlatformManager.CurrentState == PlatformManager.State.PLAYING_A_NETWORKED_MATCH)
|
|
{
|
|
PlatformManager.P2P.SendScoreUpdate(base.Score);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
GameObject gameObject = null;
|
|
if (base.HasBall)
|
|
{
|
|
if (Input.GetButton("Fire1") || Input.GetKey(KeyCode.Space))
|
|
{
|
|
gameObject = ShootBall();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
gameObject = CheckSpawnBall();
|
|
}
|
|
if ((bool)gameObject && PlatformManager.CurrentState == PlatformManager.State.PLAYING_A_NETWORKED_MATCH)
|
|
{
|
|
PlatformManager.P2P.AddNetworkBall(gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|