Skip to content

Commit

Permalink
Merge pull request #85 from osse101/fixes
Browse files Browse the repository at this point in the history
bug/warning Fixes
  • Loading branch information
Cheeseness authored Apr 25, 2017
2 parents 726124a + 40a41b5 commit f9838f0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: hit
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down
12 changes: 9 additions & 3 deletions Assets/entities/paddle/paddle-kednar2/k2_ani_cont.controller
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: moving_L
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: hit
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: pull
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down
17 changes: 9 additions & 8 deletions Assets/scripts/entity/Ball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Ball : NetworkBehaviour {

private Rigidbody rigidBody = null;
private Renderer renderer = null;
private new Renderer renderer = null;
private TrailRenderer trailRenderer = null;
private Vector3 startingPosition = Vector3.zero;
float minimumVelocity = 5;
Expand Down Expand Up @@ -127,15 +127,16 @@ public void ResetPosition()

void OnTriggerEnter(Collider Col)
{
// Respawn ball at center if on the server or local
ResetBall();

// Only handle scoring server-side of local
if (NetworkManager.singleton.isNetworkActive && NetworkServer.connections.Count == 0) return;

// If the ball collided with Goal1 or Goal2:
if (Col.gameObject.tag == "Goal1" || Col.gameObject.tag == "Goal2")
{
// Respawn ball at center if on the server or local
ResetBall();

// Only handle scoring server-side of local
if (NetworkManager.singleton.isNetworkActive && NetworkServer.connections.Count == 0) return;


// If the ball collided with Goal1:
if (Col.gameObject.tag == "Goal1")
{
Expand Down Expand Up @@ -173,7 +174,7 @@ void OnCollisionExit(Collision other)
if (other.gameObject.tag == "Paddle" ||
other.gameObject.tag == "Bumper")
{
Debug.Log ("Adding force to ball");
//Debug.Log ("Adding force to ball");
rigidBody.AddForce (rigidBody.velocity.normalized * 2.5f);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/scripts/entity/PaddleNetworking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PaddleNetworking : NetworkBehaviour {
[SyncVar]
private int paddleIndex;

void OnStartClient ()
new void OnStartClient ()
{
// The paddle is by default AI controlled
paddleClientId = PADDLE_AI;
Expand Down
6 changes: 2 additions & 4 deletions Assets/scripts/entity/powers/PowerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ public class PowerManager : NetworkBehaviour {

private const double nextPowerTimer = 30.0;

private GameObject paddle;
private double timeSinceGivenPower;
private Dictionary<powerTypes, string> powerMapping;
private bool isHost;
private PaddleBase[] playerList;

//Debugging
private uint ownerId;
//private uint ownerId;

enum powerTypes {
EMPTY,
Expand All @@ -33,7 +32,6 @@ enum powerTypes {

// Use this for initialization
void Start () {
paddle = gameObject;
timeSinceGivenPower = 0;

//Host of online game or local game
Expand Down Expand Up @@ -99,7 +97,7 @@ void giveNewPower(PaddleBase player)

player.AddPower(powerName);

Debug.Log("Power Granted: " + powerMapping[(powerTypes)randInt].ToString() + " to player " + ownerId);
//Debug.Log("Power Granted: " + powerMapping[(powerTypes)randInt].ToString() + " to player " + ownerId);

if (NetworkManager.singleton.isNetworkActive)
{
Expand Down
19 changes: 17 additions & 2 deletions Assets/scripts/ui/BasicMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ void OnGUI()
GUILayout.Label("The host is selecting a table...");
UndoCentered();

TableNetworking tableNetworking = GameObject.FindGameObjectWithTag("TableNetworking").GetComponent<TableNetworking>();
TableNetworking tableNetworking = null;
GameObject g = GameObject.FindGameObjectWithTag("TableNetworking");
if (g)
{
tableNetworking = g.GetComponent<TableNetworking>();
}

if (tableNetworking != null && tableNetworking.ServerHasSelected())
{
Expand Down Expand Up @@ -237,7 +242,17 @@ void OnGUI()

case Menu.PaddleSelect:
{
GUILayout.BeginHorizontal();
try
{
GUILayout.BeginHorizontal();
}
catch
{
//Changing the GUI creates an error here
// so we must wait until next repaint to draw
// gui elements
break;
}
// GUI Padding
GUILayout.Space(15);
GUILayout.BeginVertical();
Expand Down

0 comments on commit f9838f0

Please sign in to comment.