Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into dev
  • Loading branch information
PierreALeger committed Mar 24, 2017
2 parents d55b140 + a5b70c5 commit 91ba679
Show file tree
Hide file tree
Showing 4 changed files with 382 additions and 133 deletions.
2 changes: 2 additions & 0 deletions Assets/MenuSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void Start()
//need to make this look nicer
//192.168.0.32
NetworkManager.singleton.networkAddress = "localhost";//HARD CODE IP ADDRESS HERE
//Below is for UBISOFT
//NetworkManager.singleton.networkAddress = "192.168.0.230";//HARD CODE IP ADDRESS HERE
NetworkManager.singleton.StartClient();
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Dog/DogFP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void Move(bool crouch)
#if NETWORKING
if (grounded && !lockedMovement && !GameState.disableControls && TimeManager.GameState.NORMAL == m_TimeManager.m_GameState)
#else
if (grounded && !lockedMovement && !GameState.disableControls)
if (grounded && !lockedMovement && !GameState.disableControls && TimeManager.GameState.NORMAL == m_TimeManager.m_GameState)
#endif
{
float horizontalLook = Input.GetAxis("Mouse X");
Expand Down
49 changes: 48 additions & 1 deletion Assets/Scripts/Networking/NetworkingCharacterAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,29 @@ public enum ButtonEventType { GetButtonDown, GetButtonUp, GetButton }
public bool hostsClient;
public bool client;
public bool host;

//Add the main level names to this array (level 1, level 2, etc.)
private string[] sceneLevelNames = { "Level1Net" };

/// <summary>
/// When inheriting from this class, override the start method and add this base
/// at the end of the child Start overriding method
/// </summary>
bool goodLevel = false;

protected virtual void Start()
{
if (SceneManager.GetActiveScene().name != sceneLevelNames[0])
foreach (string levelName in sceneLevelNames)
{
if (SceneManager.GetActiveScene().name == levelName)
goodLevel = true;

}
if (!goodLevel)
{
gameObject.SetActive(false);
goodLevel = false;
}

server = NetworkCustom.isServer;

Expand All @@ -51,10 +63,20 @@ protected virtual void Start()
gameObject.SetActive(false);
gameObject.name = "hostsClient";
}

//host is the DOG
if (host)
{
BothHostAndClientsHost();

//Below is for the tutorials
var groundTutCan = GameObject.FindGameObjectsWithTag("Tutorial Canvas Ground Player");
ChangeToDisplay1(groundTutCan);

var overseerTutCan = GameObject.FindGameObjectsWithTag("Tutorial Canvas Overseer");
Deactivate(overseerTutCan);
//ends here

GameObject overseer = GameObject.FindGameObjectWithTag("Overseer");

//Might be a good idea to use a different tag for this
Expand Down Expand Up @@ -92,13 +114,38 @@ protected virtual void Start()
//object tagged which in this case is clientsHost
BothHostAndClientsHost();

//Below is for the tutorials
var overseerTutCan = GameObject.FindGameObjectsWithTag("Tutorial Canvas Overseer");
ChangeToDisplay1(overseerTutCan);

var groundTutCan = GameObject.FindGameObjectsWithTag("Tutorial Canvas Ground Player");
Deactivate(groundTutCan);
//ends here

TimeManager.disableCameraForOverseer = true;
var lucky = GameObject.FindGameObjectWithTag("Camera Ground Character");
lucky.GetComponent<Camera>().enabled = false;
gameObject.name = "clientsHost";
}
}

void ChangeToDisplay1(GameObject[] changeMe)
{
foreach (var can in changeMe)
{
//0 MEANS DISPLAY 1
can.GetComponent<Canvas>().targetDisplay = 0;
}
}

void Deactivate(GameObject[] deactivateMe)
{
foreach (var can in deactivateMe)
{
can.SetActive(false);
}
}

void BothHostAndClientsHost()
{

Expand Down
Loading

0 comments on commit 91ba679

Please sign in to comment.