private void CheckClose() { Ray ray = new Ray(playerCamera.transform.position, playerCamera.transform.forward); RaycastHit hit; if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, 2)) { if (hit.transform.tag == "Hole") { HoleController hole = hit.transform.gameObject.GetComponent <HoleController>(); if (hole.GetOpen() == true) { hole.Close(); } } else if (hit.transform.tag == "Empolyee") { EmpolyeeController empolyee = hit.transform.gameObject.GetComponent <EmpolyeeController>(); if (empolyee.GetHanging() == true) { empolyee.Climb(); } } } }
public void AIGetFood() { int tries = 0; while (tries < 4) { int randomNum = Random.Range(0, empolyees.Length); if (computers.Length != 0) { EmpolyeeController compCon = empolyees[randomNum].GetComponent <EmpolyeeController>(); if (compCon.GetIsHome() == true && compCon.GetDead() == false) { compCon.SetPath(fridgeLoc, 0); tries = 4; } } tries++; } }
public void AIWonder() { int tries = 0; while (tries < 4) { int randomNum = Random.Range(0, empolyees.Length); if (computers.Length != 0) { EmpolyeeController compCon = empolyees[randomNum].GetComponent <EmpolyeeController>(); if (compCon.GetIsHome() == true && compCon.GetDead() == false) { int randomNum2 = Random.Range(0, randomLocs.Length); int randomWaitTime = Random.Range(0, 4); compCon.SetPath(randomLocs[randomNum2], randomWaitTime); tries = 4; } } tries++; } }