void init() { scenarios = scenarioRoot.GetComponentsInChildren <Scenario> (); menu.init(scenarios); menu.gameObject.SetActive(false); filterManager.init(); splineController = GetComponent <SplineController> (); characterController = GetComponent <CharacterController> (); screenCenter.x = Screen.width / 2f; screenCenter.y = Screen.height / 2f; WIPController = GetComponent <WIPController> (); VRStepBody = GetComponent <Rigidbody> (); stepDetector.enabled = false; WIPController.enabled = false; AppMaster.i.DoScenarioSelect(0); }
protected override void Start() { splineController = Camera.main.GetComponent<SplineController>(); splineInterpolator = Camera.main.GetComponent<SplineInterpolator>(); base.Start(); }
// Use this for initialization void Start() { // Get reference to CameraController cameraController_ = GetComponent <CameraController>(); splineController_ = GetComponent <SplineController>(); isMouseScrolling_ = false; }
void setController(SplineController c, CurvySpline spline, float speed) { c.Spline = spline; c.Speed = speed; c.OnControlPointReached.AddListenerOnce(OnCPReached); c.OnEndReached.AddListenerOnce(CurvyDefaultEventHandler.UseFollowUpStatic); }
public void Oust() { if (follower != null) { follower.Detach(); follower = null; } }
void hookControllerEvents(SplineController c) { if (SplineControllerOnCPReached.IsSetup) { c.OnControlPointReached.AddListener(onControllerCPReached); setupEventTarget(SplineControllerOnCPReached, ref splineControllerOnCPreachedTarget); } }
// Use this for initialization void Start () { player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>(); moveScript = player.gameObject.GetComponent<MovementController>(); splineScript = splineScript.GetComponent<SplineController>(); if(WaypointList.Count > 2) //just to prevent the thing from giving null ref error if the list is too small { lastWayPoint = WaypointList.Count - 1; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.P)) { SplineController sc = GetComponent <SplineController>(); sc.SplineRoot = GameObject.Find("Spline2"); sc.Start(); } }
void StartNewSpline() { Debug.Log("new"); SplineController sc = GetComponent <SplineController>(); GetComponent <TestMove>().FreeSpline(sc.SplineRoot); sc.SplineRoot = GetComponent <TestMove>().GetSpline(); sc.Start(); }
// Use this for initialization void Start() { SetupData(); SetupButtons(); splineInterpolator = GameObject.Find("Main Camera").GetComponent <SplineInterpolator>(); splineController = GameObject.Find("Main Camera").GetComponent <SplineController>(); topNode = new GameObject("Side Menu"); topNode.transform.position = new Vector3(-100.0f, -79.0f, 106.0f); topNode.transform.rotation = Quaternion.Euler(77.5f, 5.6f, 0); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); moveScript = player.gameObject.GetComponent <MovementController>(); splineScript = splineScript.GetComponent <SplineController>(); if (WaypointList.Count > 2) //just to prevent the thing from giving null ref error if the list is too small { lastWayPoint = WaypointList.Count - 1; } }
private void DisablePath() { pathLooping = false; SplineController path = GetComponent <SplineController>(); if (path != null) { path.enabled = false; GetComponent <SplineInterpolator>().enabled = false; } }
void setPos(SplineController c, float pos) { if (c.IsPlaying) { c.Position = pos; } else { c.InitialPosition = pos; } }
// Use this for initialization void Start() { splineCtroller = FindObjectOfType <SplineController>(); if (splineCtroller == null) { Debug.Log("SplineController is Null!"); return; } GetComponent <BoxCollider>().isTrigger = true; GetComponent <Rigidbody>().isKinematic = true; }
// Use this for initialization void Start() { this.otherScript = this.GetComponent<SplineController>(); state = -1; splineIsRunning = false; timePast = 0.0f; print (otherScript.SplineRoot); myAnimator = GetComponent<Animator> (); myAnimator.SetFloat ("VSpeed", 0.0f); }
void Start() { splineC = fishgroup.gameObject.GetComponent <SplineController>(); splineI = fishgroup.gameObject.GetComponent <SplineInterpolator>(); nodes = splineI.GetPoints(); moveMode = splineI.GetState(); isRotate = splineI.IsRotate(); if (isfullpath == false) { delay = Random.Range(0, delay); } }
// Use this for initialization void Start() { this.otherScript = this.GetComponent <SplineController>(); state = -1; splineIsRunning = false; timePast = 0.0f; print(otherScript.SplineRoot); myAnimator = GetComponent <Animator> (); myAnimator.SetFloat("VSpeed", 0.0f); }
void Start() { if(sc == null) { sc = this.GetComponent<SplineController>() as SplineController; } if(si == null) { si = this.GetComponent<SplineInterpolator>() as SplineInterpolator; } }
void Start() { if (sc == null) { sc = this.GetComponent <SplineController>() as SplineController; } if (si == null) { si = this.GetComponent <SplineInterpolator>() as SplineInterpolator; } }
/// <summary> /// Use a follow up, if present /// </summary> public static void UseFollowUpStatic(CurvySplineMoveEventArgs e) { // we need a SplineController as well as a following spline to work with if (e.Sender is SplineController && e.ControlPoint.FollowUp) { // Follow the connected spline e.Follow(e.ControlPoint.FollowUp, e.ControlPoint.FollowUpHeading); // Set the controller to use the new spline SplineController controller = (SplineController)e.Sender; controller.Spline = e.Spline; controller.RelativePosition = e.TF; // Handle controller events for the new passed ControlPoint controller.OnControlPointReached.Invoke(e); } }
private void OnTriggerEnter(Collider other) { if (other.GetComponent <SplineController>()) { SplineController s = other.GetComponent <SplineController>(); if (s.activeSpline != spline) { s.activeSpline = spline; } else if (s.activeSpline == spline) { s.activeSpline = null; } } }
void OnCPReached(CurvySplineMoveEventArgs e) { var jc = e.ControlPoint.GetMetadata <MDJunctionControl>(); if (jc) { if (jc.UseJunction) { e.Follow(e.ControlPoint.Connection.OtherControlPoints(e.ControlPoint)[0]); // Set the controller to use the new spline SplineController controller = (SplineController)e.Sender; controller.Spline = e.Spline; controller.RelativePosition = e.TF; } } }
// A: Use Head To/Follow Up ControlPoint to proceed // B: Start Falling if any Control Point connected // C: Else Die! public void UseFollowUpOrFall(CurvySplineMoveEventArgs e) { // we need a SplineController as well as a following spline to work with if (e.Sender is SplineController) { if (e.ControlPoint.FollowUp) { // Follow the connected spline e.Follow(e.ControlPoint.FollowUp, e.ControlPoint.FollowUpHeading); // Set the controller to use the new spline SplineController controller = (SplineController)e.Sender; controller.Spline = e.Spline; controller.RelativePosition = e.TF; // handle controller events for the new passed ControlPoint controller.OnControlPointReached.Invoke(e); } else { if (e.ControlPoint.Connection) { var otherCP = e.ControlPoint.Connection.OtherControlPoints(e.ControlPoint)[0]; mFreeFallTarget = otherCP.Spline; if (mMode == GuideMode.Jumping) { e.Follow(otherCP, ConnectionHeadingEnum.Auto); Spline = mFreeFallTarget; RelativePosition = otherCP.LocalFToTF(0); mNewMode = GuideMode.FreeFall; } else { mMode = GuideMode.FreeFall; } } else { Debug.Log("YOU DIED!"); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } } } }
// Use this for initialization void Start() { scenarios = scenarioRoot.GetComponentsInChildren <Simulation> (); menu.init(scenarios); menu.gameObject.SetActive(false); splineController = GetComponent <SplineController> (); characterController = GetComponent <CharacterController> (); // Application.targetFrameRate = 10; screenCenter.x = Screen.width / 2f; screenCenter.y = Screen.height / 2f; AppMaster.i.DoScenarioSelect(0); }
// Use this for initialization void Awake() { lastStartTime = StartPercentage; if (outerRail != null) { outerController = outerRail.gameObject.GetComponent<SplineController>(); if (outerController == null) { enabled = false; return; } } if (innerRail != null) { innerController = innerRail.gameObject.GetComponent<SplineController>(); if (innerController == null) { enabled = false; return; } } innerController.Duration = duration; outerController.Duration = duration; innerController.OrientationMode = eOrientationMode.NODE; outerController.OrientationMode = eOrientationMode.NODE; //innerController.WrapMode = eWrapMode.LOOP; //outerController.WrapMode = eWrapMode.LOOP; if (lookAtObj != null) { Transform[] temp = lookAtObj.GetComponentsInChildren<Transform>(); if (temp.Length >= 3) { pointA = temp[1].position; pointB = temp[2].position; } } else lookAtFollow = false; }
// Use this for initialization void Start() { CurrentState_ = GAMESTATE.IDLE; // Locate scripts CameraController_ = Camera.main.GetComponent <CameraController>(); SplineController_ = Camera.main.GetComponent <SplineController>(); eventController_ = EventController.eventController; musicManager = MusicManager.musicManager; foreach (Camera c in Camera.allCameras) { if (c.gameObject.name == "Main Camera") { mainCam = c; } else if (c.gameObject.name == "SplashScreenCam") { previewCam = c; } } // Get transform for main camera, used in resetting camera later // NOTE: storing the transform itself does not work, as this is a pointer to a variable, rather than storing an instance mainCamMenuPos = mainCam.transform.position; mainCamMenuRot = mainCam.transform.rotation; GameUI_ = GetComponent <HUDToggle>(); // Set UI to be inactive at start //OverlayActive_ = false; //GameUI_.UIVisible(OverlayActive_); GameUI_.UpdateUI(); // NO LONGER USED FOR CAMERA MOVEMENT //camMenuToGame_ = Resources.Load("Events/GameStateController/GotoGameStart") as Event; // Set Active cameras mainCam.enabled = false; previewCam.enabled = true; }
public void GenerateStemSpline() { Debug.Log("Generating Stem Spline"); _stemSplineObject = new GameObject("StemSplineController"); _stemSplineObject.AddComponent <SplineInterpolator>(); _stemSplineController = _stemSplineObject.AddComponent <SplineController>(); var root = new GameObject("root"); root.transform.parent = _stemSplineObject.transform; _stemSplineController.SplineRoot = root; _stemSplineController.AutoClose = false; _stemSplineController.AutoStart = false; var firstNode = new GameObject("Node0"); firstNode.transform.parent = root.transform; for (var i = 1; i < _numberOfTwists + 2; i++) { var node = new GameObject(string.Format("Node{0}", i)); node.transform.parent = root.transform; var x = Random.Range(-_curviness, _curviness); var y = (i / (_numberOfTwists + 1f)) * StemHeight; var z = Random.Range(-_curviness, _curviness); if (i == _numberOfTwists + 1) { x = z = 0; } node.transform.position = new Vector3(x, y, z); _lastStemNode = node.transform.position; } //TestSplineController(); }
public void UseRandomConnectionStatic(CurvySplineMoveEventArgs e) { // we need a SplineController as well as a connection to work with if (e.Sender is SplineController && e.ControlPoint.Connection) { CurvySplineSegment current = e.ControlPoint; // Find a new spline to follow: // Get all connected ControlPoints and check angle var others = e.ControlPoint.Connection.OtherControlPoints(current); // If it's smaller or equal 90°, consider the connected spline as a valid path to follow, otherwise remove it from the list for (int i = others.Count - 1; i >= 0; i--) { if (e.AngleTo(others[i]) > 90) { others.RemoveAt(i); } } int randomIndex = Random.Range(-1, others.Count); if (randomIndex < 0) // don't follow another, but use FollowUp if present { if (current.FollowUp) { e.Follow(current.FollowUp, current.FollowUpHeading); // Follow the connected spline } } else { e.Follow(others[randomIndex]); // Follow the new spline } // Set the controller to use the new spline SplineController controller = (SplineController)e.Sender; controller.Spline = e.Spline; controller.RelativePosition = e.TF; } }
// Begin called at start of action public override void Begin(NarrativeEvent newEvent) { base.Begin(newEvent); // Setup reference to spline controller splineController = Camera.main.GetComponent <SplineController>(); // Setup reference to force look at forceLookAt = Camera.main.GetComponent <ForceLookAt>(); //instantiatedRoot_ = Instantiate(splineRoot_); // set time it will take the spline movement to complete one whole movement // Default is 5 seconds splineController.Duration = movementTime_; // set wrapping of the spline // LOOP repeats, ONCE moves through the spline once // Make sure that looping splines autoclose or there will be a noticeable gap if (loopingMovement_) { splineController.WrapMode = eWrapMode.LOOP; splineController.AutoClose = true; } else { splineController.WrapMode = eWrapMode.ONCE; splineController.AutoClose = false; } // Set look at variables if required forceLookAt.active = lookAtActive_; forceLookAt.target = forcedLookAtPosition_; // set spline root and start movement splineController.FollowSpline(splineRoot_); }
private void OnTriggerEnter(Collider other) { SplineController character = other.gameObject.GetComponent <SplineController>(); if (character != null) { if (character.CurrentSpline == null) { Spline nextSpline = transform.parent.GetComponent <Spline>(); SplineNode nextNode = node; Vector3 target = (other.transform.position + transform.position) * 0.5f; Vector3 position; if (character.FindSplineVertex(nextSpline, other.transform.position, transform.position, out nextNode, out position)) { character.Land(position, nextSpline, nextNode); } else { Debug.LogWarning("Error in findNextSpline - Couldn't Land"); } } } }
// Use this for initialization void Start() { PLAYER = this; _splineController = GetComponent<SplineController>() as SplineController; }
public void GenerateStemSpline() { Debug.Log("Generating Stem Spline"); _stemSplineObject = new GameObject("StemSplineController"); _stemSplineObject.AddComponent<SplineInterpolator>(); _stemSplineController = _stemSplineObject.AddComponent<SplineController>(); var root = new GameObject("root"); root.transform.parent = _stemSplineObject.transform; _stemSplineController.SplineRoot = root; _stemSplineController.AutoClose = false; _stemSplineController.AutoStart = false; var firstNode = new GameObject("Node0"); firstNode.transform.parent = root.transform; for (var i = 1; i < _numberOfTwists + 2; i++) { var node = new GameObject(string.Format("Node{0}", i)); node.transform.parent = root.transform; var x = Random.Range(-_curviness, _curviness); var y = (i / (_numberOfTwists + 1f)) * StemHeight; var z = Random.Range(-_curviness, _curviness); if (i == _numberOfTwists + 1) x = z = 0; node.transform.position = new Vector3(x, y, z); _lastStemNode = node.transform.position; } //TestSplineController(); }
public void GenerateCapSpline() { Debug.Log("Generating Cap Spline"); _capSplineObject = new GameObject("CapSplineController"); _capSplineObject.AddComponent<SplineInterpolator>(); _capSplineController = _capSplineObject.AddComponent<SplineController>(); var root = new GameObject("root"); root.transform.parent = _capSplineObject.transform; root.transform.position = _lastStemNode + new Vector3(StemTopRadius, 0f, 0f); _capSplineController.SplineRoot = root; _capSplineController.AutoClose = false; _capSplineController.AutoStart = false; var node = new GameObject("Node0"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(); node = new GameObject("Node1"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.25f, _capHeight * 0.3f, 0f); node = new GameObject("Node2"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.6f, _capHeight * 0.15f, 0f); node = new GameObject("Node3"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius, 0f, 0f); node = new GameObject("Node4"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.8f, _capHeight * 0.65f, 0f); node = new GameObject("Node5"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.45f, _capHeight * 0.95f, 0f); node = new GameObject("Node6"); node.transform.parent = root.transform; node.transform.position = new Vector3(0f, StemHeight + _capHeight , 0f); // for (var i = 1; i < 7; i++) // { // var node = new GameObject(string.Format("Node{0}", i)); // node.transform.parent = root.transform; // node.transform.localPosition = new Vector3(); // // var x = Random.Range(-_curviness, _curviness); // var y = (i / (_numberOfTwists + 1f)) * StemHeight; // var z = Random.Range(-_curviness, _curviness); // // if (i == _numberOfTwists + 1) // x = z = 0; // // node.transform.position = new Vector3(x, y, z); // } //TestSplineController(); }
public void GenerateCapSpline() { Debug.Log("Generating Cap Spline"); _capSplineObject = new GameObject("CapSplineController"); _capSplineObject.AddComponent <SplineInterpolator>(); _capSplineController = _capSplineObject.AddComponent <SplineController>(); var root = new GameObject("root"); root.transform.parent = _capSplineObject.transform; root.transform.position = _lastStemNode + new Vector3(StemTopRadius, 0f, 0f); _capSplineController.SplineRoot = root; _capSplineController.AutoClose = false; _capSplineController.AutoStart = false; var node = new GameObject("Node0"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(); node = new GameObject("Node1"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.25f, _capHeight * 0.3f, 0f); node = new GameObject("Node2"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.6f, _capHeight * 0.15f, 0f); node = new GameObject("Node3"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius, 0f, 0f); node = new GameObject("Node4"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.8f, _capHeight * 0.65f, 0f); node = new GameObject("Node5"); node.transform.parent = root.transform; node.transform.localPosition = new Vector3(_capRadius * 0.45f, _capHeight * 0.95f, 0f); node = new GameObject("Node6"); node.transform.parent = root.transform; node.transform.position = new Vector3(0f, StemHeight + _capHeight, 0f); // for (var i = 1; i < 7; i++) // { // var node = new GameObject(string.Format("Node{0}", i)); // node.transform.parent = root.transform; // node.transform.localPosition = new Vector3(); // // var x = Random.Range(-_curviness, _curviness); // var y = (i / (_numberOfTwists + 1f)) * StemHeight; // var z = Random.Range(-_curviness, _curviness); // // if (i == _numberOfTwists + 1) // x = z = 0; // // node.transform.position = new Vector3(x, y, z); // } //TestSplineController(); }
void Start() { mSplineController = GetComponent(typeof(SplineController)) as SplineController; }
public override void OnInspectorGUI() { SplineController controller = (SplineController)target; //Cast the target (from Unity) as a SplineController controller.go = EditorGUILayout.Toggle("Go", controller.go); controller.reverseOrientation = EditorGUILayout.Toggle("Rev Orientation", controller.reverseOrientation); controller.currentSpline = (Spline)EditorGUILayout.ObjectField("Current Spline", controller.currentSpline, typeof(Spline)); controller.gravSpline = (Spline)EditorGUILayout.ObjectField("Gravity Spline", controller.gravSpline, typeof(Spline)); controller.gravityForce = EditorGUILayout.FloatField("Gravity Force", controller.gravityForce); controller.looseFollow = EditorGUILayout.Toggle("Loose Follow", controller.looseFollow); controller.snapDistance = EditorGUILayout.FloatField("Snap Distance", controller.snapDistance); if (controller.currentSpline) { controller.startOnVert = EditorGUILayout.Toggle("Start On Vertex", controller.startOnVert); if (controller.startOnVert) { controller.startVert = EditorGUILayout.IntSlider("Initial Vertex", controller.startVert, 0, controller.currentSpline.Length - 1); } } controller.mode = (SplineController.Mode)EditorGUILayout.EnumPopup("Mode:", controller.mode); switch (controller.mode) { case SplineController.Mode.KEYBOARD: controller.airForce = EditorGUILayout.FloatField("Air Force", controller.airForce); controller.maxAirSpeed = EditorGUILayout.FloatField("Max Air Speed", controller.maxAirSpeed); controller.runForce = EditorGUILayout.FloatField("Run Force", controller.runForce); controller.maxRunSpeed = EditorGUILayout.FloatField("Max Run Speed", controller.maxRunSpeed); controller.stopForce = EditorGUILayout.FloatField("Stop Force", controller.stopForce); controller.jumpVelocity = EditorGUILayout.FloatField("Jump Velocity", controller.jumpVelocity); controller.horizSpeed = EditorGUILayout.FloatField("Initial Speed", controller.horizSpeed); break; case SplineController.Mode.MOUSE: controller.hoverOffset = EditorGUILayout.Vector3Field("Hover Offset", controller.hoverOffset); break; default: controller.goInReverse = EditorGUILayout.Toggle("Go In Reverse", controller.goInReverse); controller.horizSpeed = EditorGUILayout.FloatField("Initial Speed", controller.horizSpeed); break; } //GUILayout.BeginHorizontal(); //if(GUILayout.Button("Add Prev")) { //Create a new node before this one // Selection.activeObject = node.AddPrev(); //} //if(GUILayout.Button("Add Next")) { // Selection.activeObject = node.AddNext(); //} //GUILayout.EndHorizontal(); //if(GUILayout.Button("Disconnect")) { // try { // if(node.previous) Selection.activeObject = node.previous; // else if(node.next) Selection.activeObject = node.next; // else Selection.activeObject = null; // node.Disconnect(); // } catch(System.Exception e) { } //} controller.advancedMode = EditorGUILayout.Foldout(controller.advancedMode, "Advanced"); if (controller.advancedMode) { DrawDefaultInspector(); } }
// Use this for initialization void Start() { PLAYER = this; _splineController = GetComponent <SplineController>() as SplineController; }
public void Get(SplineController follower) { this.follower = follower; }
// Use this for initialization void Start() { this.splineController = GetComponent <SplineController> (); this.rigidBody = GetComponent <Rigidbody> (); }