void Start() { lights = transform.GetChild(0).gameObject.GetComponent <Light>(); tracker = transform.GetChild(2).gameObject; roomTemplates = GameObject.Find("Station").GetComponent <RoomTemplates>(); endingScript = GameObject.Find("Ending Interior").GetComponent <EndingScript>(); StartCoroutine(lightTimer(0.5F)); }
void Update() { //hold the item if (pawn && pawn.holding) { PickUp temp = FindObjectOfType <PickUp>(); //make the item get picked up pawn.interactStrat.Update(Time.deltaTime, pawn.netIdentity, temp.netIdentity); } //mess with mesh meshObj.transform.rotation = Quaternion.Euler(-vertical * wobble, 0, horizontal * wobble); if (isServer) { if (score < 99) { if (pawn.holding) { if (time >= 2) { time = 0; score++; wobble++; } time += Time.deltaTime; } else { time = 0; } } else { EndingScript end = FindObjectOfType <EndingScript>(); end.gameEnded = true; //change ui } } // movement for local player if (!isLocalPlayer) { return; } if (pawn.movementSpeed == 0) { if (timer2 >= 2) { timer2 = 0; pawn.movementSpeed = 200; } else { time += Time.deltaTime; } } vertical = Input.GetAxis(vertAxis); horizontal = Input.GetAxis(horiAxis); if (pawn.holding) { //move set weird vertical = vertical + ((Mathf.PerlinNoise(Time.time, 1) - 0.5f) * 2); horizontal = horizontal + ((Mathf.PerlinNoise(Time.time * 2, 1) - 0.5f) * 2); } CmdSync(horizontal, vertical); //actual movement if (vertical != 0 || horizontal != 0) { pawn.moveStrat.Held(Time.deltaTime, pawn.GetComponent <Rigidbody>(), new Vector3(horizontal, 0, vertical)); //moveCom.predict(pawn.netIdentity); } RaycastHit hit; Physics.Raycast(pawn.GetComponent <Rigidbody>().position, Vector3.down, out hit, 0.4f); if (hit.collider) { if (!jumping) { // jump if (Input.GetKeyDown(jumpKey) && hit.collider) { pawn.jumpStrat.JustPressed(Time.deltaTime, pawn.GetComponent <Rigidbody>(), hit.collider); jumping = true; } } } else if (jumping) { jumping = false; } //pick up the item if (Input.GetKeyDown(interactKey)) { Cmdpickup(); } }