void Update()
{
//if there is a time to be taken set && the current time is passed the time to take
if (timeToBeTaken > 0 && TimeManager.Instance.ClientTimeStamp > timeToBeTaken)
{
//already owned
if (teamOwnedBy == currentTeamClaim)
{
//pRenderer.material = partMaterials[teamOwnedBy];
//emitter.emit = true;
if (_isPlayer)
{
if (locked)
{
Debug.Log("REFUEL!!!");
manager.myAvatar.GetComponent<Player>().refuel();
manager.flashRefuel();
}
}
}
else
{
if (willPaint && !locked)
{
teamLastOwnedBy = teamOwnedBy;
teamOwnedBy = currentTeamClaim;
cube.GetComponent<Cube>().setSideColor(transform.gameObject, colors[teamOwnedBy], teamLastOwnedBy);
Debug.Log("team owned by: " + teamOwnedBy);
pRenderer.material = partMaterials[teamOwnedBy];
emitter.emit = true;
//UPDATE SCORE *****/
GameManager.Instance.UpdateTeamScore(teamLastOwnedBy, teamOwnedBy);
/*****/
}
if (_isPlayer)
{
if (willPaint && !locked)
{
manager.myAvatar.GetComponent<Player>().subtractPaint();
if(teamLastOwnedBy == -1)
GameManager.Instance.UpdateCapturedScore();
else
GameManager.Instance.UpdateStolenScore();
}
}
}
timeLastTaken = timeToBeTaken;
timeToBeTaken = -1;
}
if (emitter.emit == true && timeLastTaken + LOCKINTERVAL < TimeManager.Instance.ClientTimeStamp)
{
emitter.emit = false;
}
}