void Execute() { state = foldState.peaked; //RaycastHit foldClearance; //Ray FoldAhead = new Ray(foldIcon.transform.position, player.transform.forward); //if (Physics.Raycast(FoldAhead, out foldClearance, 1f)) //if (player.GetComponent<Rigidbody>().SweepTest(player.transform.forward, out foldClearance, JumpDistance)) if (obstructed()) { //Debug.Log(foldClearance.collider.name); DialogueBox.Dialogue.text = "Fold Jump Obstructed"; GameLog.toLog("Fold Jump Obstructed"); jumpDelay = fixedJumpChargeTime; return; } state = foldState.discharging; //disengage = true; player.transform.position = foldIcon.transform.position; DialogueBox.Dialogue.text = "Fold Jump Successful"; GameLog.toLog("Fold Jump Successful"); //instantiate jump pop Instantiate(disCharge, player.transform.position, player.transform.rotation); // Reset(); }
void stateUpdate() { /* public enum foldState * { * waiting, * inactive, * charging, * peaked, * engaged, * discharging, * * }*/ if (state == foldState.waiting) { state = foldState.inactive; } if (state == foldState.charging) { Charging(); } if (state == foldState.discharging) { Execute(); Reset(); } }
public void FixedJump(float FixedJumpDistance = 1000f) { state = foldState.peaked; JumpDistance = FixedJumpDistance; jumpDelay = fixedJumpChargeTime; fixedJumpEnabled = true; // FoldDriveEngaged = true; }
void Charging() { if (JumpDistance < maxJump && PlayerControllerAlpha.charge > 0.0f) { JumpDistance += advRate * Time.deltaTime; // ((chargeTime * advRate) * (chargeTime * advRate)) + minJump; PlayerControllerAlpha.charge -= (foldCost * Time.deltaTime); } else { state = foldState.peaked; } clearAhead.gameObject.SetActive(true); //instantiate jump effect charge if (dropper) { Instantiate(charge, player.transform.position, player.transform.rotation); } else { charge.SetActive(true); } if (jumpDelay > 0) { jumpDelay -= Time.deltaTime; } else { Execute(); } DialogueBox.Dialogue.text = "Fold Jump Distance: " + Mathf.RoundToInt(JumpDistance * rfScale) + "m"; foldIcon.transform.localPosition = Vector3.forward * JumpDistance; clearAhead.transform.position = foldIcon.transform.position; }
public void Reset() { state = foldState.waiting; // disengage = false; // maxReached = false; if (!dropper) { charge.SetActive(false); } JumpDistance = 0f; jumpDelay = 0f; // maxReached = false; // FoldDriveEngaged = false; // buttonPressed = false; // buttonReleased = false; clearAhead.gameObject.SetActive(false); //foldIcon.transform.localPosition = Vector3.zero; }
public void JumpExecute() { state = foldState.discharging; }
public void JumpCharge() { state = foldState.charging; jumpDelay = 1f; }