public override RopeCollisionType collideWithRopeLine(RopeLine line) { if (isRopeAttachable()) { return(RopeCollisionType.CAN_ATTACH); } else { return(RopeCollisionType.CAN_NOT_ATTACH_AND_CUT); } }
private void Update() { //Tether movement float axisY = XCI.GetAxis(XboxAxis.LeftStickY, controller); //Store the direction and magnitude of the left joystick Y axis tether.currentLength += tether.changeSpeed * -axisY * Time.deltaTime; //Move tether length up/down based on this //Animation //if the control stick is pushed 40% of the way upwards if (axisY >= 0.4) { //sets the animation state to moving forward characterAnim.SetBool("MovingForward", true); characterAnim.SetBool("MovingBackward", false); } //if the control stick is pushed 40% of the way downwards else if (axisY <= -0.4) { //sets the animation state to moving backwards characterAnim.SetBool("MovingForward", false); characterAnim.SetBool("MovingBackward", true); } //if neither else { //sets the animation state to idle characterAnim.SetBool("MovingForward", false); characterAnim.SetBool("MovingBackward", false); } //Sideways movement if (tether.Distance() >= (tether.currentLength * 0.95f)) //As long as the skier is close to the arc of the tether, { float axisX = XCI.GetAxis(XboxAxis.LeftStickX, controller); //Store the direction and magnitude of the left joystick X axis tether.ApplyForce(new Vector3(movingForce * axisX, 0, 0)); //Apply an instantaneous sideways force //Animation //if the control stick is pushed 40% of the way to the right if (axisX >= 0.4) { //sets the animation state to moving right characterAnim.SetBool("MovingLeft", false); characterAnim.SetBool("MovingRight", true); } //if the control stick is pushed 40% of the way to the left else if (axisX <= -0.4) { //sets the animation state to moving left characterAnim.SetBool("MovingRight", false); characterAnim.SetBool("MovingLeft", true); } //if neither else { //sets the animation state to idle characterAnim.SetBool("MovingRight", false); characterAnim.SetBool("MovingLeft", false); } } //Easter egg if (!m_eggUnlocked) { for (XboxButton i = 0; i <= XboxButton.Y; ++i) { if (XCI.GetButtonDown(i)) { if (i == m_sequence[m_progress]) { ++m_progress; if (m_sequence[m_progress] == 0) { m_eggUnlocked = true; } } else { m_progress = 0; } } } } else { if (XCI.GetButtonDown(XboxButton.A)) { tether.ApplyForce(new Vector3(0, 500, 0)); } } //Wipeout if (m_isAlive == false) { //Make them sink Vector3 newPos = transform.position; newPos.y -= Time.deltaTime; transform.position = newPos; //Make their tether fade RopeLine renderedTether = GetComponentInChildren <RopeLine>(); if (renderedTether != null) { renderedTether.Fade(1); } } bonkResolved = false; }
// Action when collide with rope line public RopeCollisionType collideWithRopeLine(RopeLine line) { return(RopeCollisionType.CAN_NOT_ATTACH_AND_THROUGH); }
public abstract RopeCollisionType collideWithRopeLine(RopeLine line);
public override RopeCollisionType collideWithRopeLine(RopeLine line) { return(RopeCollisionType.CAN_NOT_ATTACH_AND_CUT); }