public void DrawGUI(bool renderCurves) { //Data node = target as CurveNode; parentSpline = node.GetComponentInParent <BezierSpline>(); handleTransform = node.transform; handleRotation = (Tools.pivotRotation == PivotRotation.Local ? node.transform.rotation : Quaternion.identity); //Rendering SetInTangentGizmo(); SetOutTangentGizmo(); if (renderCurves && parentSpline != null) { if (node.index == null || node.index == -1) { node.index = parentSpline.GetIndexOfNode(node); } if (node.index != -1) { RenderAdjacentCurves(); } } }
private void AttemptTravel() { if (IsCarrying()) { return; } // test is on start node switch (m_Electric) { case (true): //is currently moving m_SplineMover.disableSplineMovement(); m_Electric = false; break; case (false): if (mEnteredCurveNode != null) { var spline = mEnteredCurveNode.GetComponentInParent <BezierSpline>(); if (spline != null) { //Begin wire travel if (spline.GetIndexOfNode(mEnteredCurveNode) == 0) //If start of curve { m_SplineMover.enableSplineMovement(PlayerSplineWalker.TravelDirection.Forward, spline); } else //if end of curve { m_SplineMover.enableSplineMovement(PlayerSplineWalker.TravelDirection.Backward, spline); } m_Electric = true; Debug.Log("Attempted to Travel"); audioSource.PlayOneShot(electrcity); ChangeHappiness(-5); } else { Debug.LogError("Could not find parent spline of curve node " + mEnteredCurveNode.index); } // travel through wire // // change animation } break; } if (mEnteredCurveNode != null) { // travel through wire m_Electric = !m_Electric; Debug.Log("Attempted to Travel"); // // change animation } }