// Update is called once per frame void Update() { if (Input.GetButtonDown("Heal")) { Heal(); } //text.text = "Attack1 Charges: " + (int) attack1Charges + " " + "Attack2 Charges: " + (int) attack2Charges + " " + "Dash Charges: " + (int) dashCharges; // Debug.Log (text.text); //register all the inputs that need to be dynamically tracked //movement key inputs movementInput = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")); //mouse position Ray camRay = playerCamera.ScreenPointToRay(Input.mousePosition); RaycastHit floorHit; if (Physics.Raycast(camRay, out floorHit, playerCamera.farClipPlane, LayerMask.GetMask("MouseRaycast"))) { Vector3 p2m = floorHit.point - transform.position; p2m.y = 0f; playerToMouse = p2m.normalized; } //Animate currentState.Animate(); //carry out state-specific orders currentState.Update(); if (stateEnded) { if (nextState == null) { this.nextState = currentState.HandleInput(); } stateEnded = false; } if (this.GetComponent <Health>().currentHealth <= 0) { this.currentState.Exit(); LoadOnClick.StaticLoadSceneByName("MainMenu"); } }
public override void FixedUpdate() { Quaternion change = Quaternion.Euler(0, 179 + bc.gameObject.transform.rotation.eulerAngles.y, 0); bc.gameObject.transform.rotation = Quaternion.Slerp(bc.gameObject.transform.rotation, change, Time.deltaTime); bc.gameObject.GetComponentInChildren <SpriteRenderer>().color = new Color(1f, 1f, 1f, bc.gameObject.GetComponentInChildren <SpriteRenderer>().color.a * .9f); // Color col = sr.color; // col.a *= .7f; // sr.color = col; // Debug.Log (ec.gameObject.GetComponentInChildren<SpriteRenderer> ().color); if (bc.gameObject.transform.rotation.eulerAngles.y > 200) { LoadOnClick.StaticLoadSceneByName("Credits"); } //dieTimer += Time.deltaTime; //if (dieTimer >= dieDuration) //{ //} }
void FixedUpdate() { if (panelIndex == canvasGroups.Length) { LoadOnClick.StaticLoadSceneByName("MainMenu"); } switch (panelState) { case 0: canvasGroups[panelIndex].alpha += Time.deltaTime / panelRiseTime; if (canvasGroups[panelIndex].alpha >= 1) { panelState++; } break; case 1: panelStayTimer += Time.deltaTime; if (panelStayTimer >= panelStayTime) { panelState++; panelStayTimer = 0; } break; case 2: canvasGroups[panelIndex].alpha -= Time.deltaTime / panelFallTime; if (canvasGroups[panelIndex].alpha <= 0) { panelIndex++; panelState = 0; } break; default: break; } }