FollowSpline() public method

Starts the interpolation
public FollowSpline ( ) : void
return void
Exemplo n.º 1
0
 public void Play()
 {
     GameObject.Find("Logo").SetActive(false);
     m_panelMenu.SetActive(false);
     splineController.FollowSpline();
     StartCoroutine(ShowCustomization());
 }
    public void ButtonOnClick(int index)
    {
        if (firstTransition)
        {
            currPos = GameObject.Find("Main Camera").transform.position;
            currRot = GameObject.Find("Main Camera").transform.rotation;
            GameObject currSplineRoot = new GameObject();
            GameObject firstNode      = new GameObject();
            firstNode.name = "1";
            firstNode.transform.position = currPos;
            firstNode.transform.rotation = currRot;
            firstNode.transform.parent   = currSplineRoot.transform;

            GameObject targetNode = new GameObject();
            targetNode.name = "3";
            targetNode.transform.position = data[index].pos;
            targetNode.transform.rotation = data[index].rot;

            targetNode.transform.parent = currSplineRoot.transform;

            topNode.name             = "2";
            topNode.transform.parent = currSplineRoot.transform;

            splineController.SplineRoot = currSplineRoot;
            //splineInterpolator.Reset();
            splineController.Duration = 3;
            splineController.WrapMode = eWrapMode.ONCE;
            splineController.FollowSpline();
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (!startedAI && state.inProgress)
     {
         rigidBody.constraints = RigidbodyConstraints.None;
         splineController.FollowSpline();
         startedAI = true;
     }
 }
Exemplo n.º 4
0
    IEnumerator MoveCameraAfterDialogueEnd()
    {
        while (GameScheduler.instance.dialogue.in_dialogue)
        {
            yield return(new WaitForSeconds(GameScheduler.dt));
        }

        // Start camera travelling
        splineController.FollowSpline();
        splineController2.FollowSpline();
    }
Exemplo n.º 5
0
    void Update()
    {
        counter += Time.deltaTime;
        if (counter > 75f)
        {
            counter = 0;
            splineController.FollowSpline();
        }

        if (waitAnyKey)
        {
            if (Input.anyKey /* || Input.GetButtonDown("Fire1") || Input.GetButtonDown("Jump") || Input.GetButtonDown("Fire2") || Input.GetButtonDown("Exit")*/)
            {
                waitAnyKey = false;
                m_panelAnyKey.SetActive(false);
                m_panelMenu.SetActive(true);
            }
        }
    }
Exemplo n.º 6
0
    // 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_);
    }
Exemplo n.º 7
0
    void JumpLogic()
    {
        switch (States)
        {
        case JumpStates.NOTSTARTED:
            if (DistBetween(player.position, WaypointList[0].position) < 2)     //check distance between player and waypoint
            {
                Debug.Log("Near");
                if (CheckWaypoint(currentWayPoint))     //if facing?
                {
                    Debug.Log("facing and near");
                    if (GamepadManager.buttonADown)     //if player jumps?
                    {
                        Debug.Log("Jumped");
                        SplineJump(0);                                                   //moves the spline root to the correct positons
                        splineScript.FollowSpline();                                     //makes the spline move
                        currentWayPoint++;                                               //sets to ext waypoint
                        freezeMovement        = true;                                    //then you freeze
                        moveScript.charStates = MovementController.States.sequencedjump; // and set its state
                        States = JumpStates.STARTING;
                    }
                }
            }
            break;

        case JumpStates.STARTING:
            if (DistBetween(player.position, WaypointList[currentWayPoint].position) < 5)
            {
                if (CheckWaypoint(currentWayPoint))
                {
                    if (GamepadManager.buttonADown)
                    {
                        SplineJump(currentWayPoint);
                        splineScript.FollowSpline();
                        currentWayPoint++;
                    }
                }
            }
            if ((currentWayPoint + 2) == WaypointList.Count)
            {
                States = JumpStates.ENDING;
            }
            break;

        case JumpStates.JUMPING:
            break;

        case JumpStates.ENDING:
            if (DistBetween(player.position, WaypointList[currentWayPoint].position) < 5)
            {
                if (CheckWaypoint(currentWayPoint))
                {
                    if (GamepadManager.buttonADown)
                    {
                        SplineJump(currentWayPoint);
                        splineScript.FollowSpline();
                        freezeMovement  = false;    //then you unfreeze
                        currentWayPoint = 0;
                        States          = JumpStates.NOTSTARTED;
                        // moveScript.charStates = MovementController.States.sequencedjump; // and set its state

                        //   currentWayPoint++;
                    }
                }
            }
            break;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (state == 0)
        {
            if (!splineIsRunning)
            {
//				otherScript.setSplineObject (SplineRootGroup [0], SplineRootDurationGroup[0]);
                otherScript.FollowSpline();
                print(otherScript.SplineRoot);
                myAnimator.SetFloat("VSpeed", 1.0f);
                bunnyHopInstructions.Play();
                splineIsRunning = true;
                timePast        = Time.realtimeSinceStartup;
            }
            else
            {
                if (Time.realtimeSinceStartup - timePast >= 6)
                {
                    (referenceToBuzz.GetComponent <FirstPersonController>()).intialMovement = false;
                }
                if (Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[0])
                {
                    splineIsRunning = false;
                    timePast        = 0;
                    comeHereAudio.Play();
                    state = 1;
                }
            }
        }
        else if (state == 1)
        {
            //this.setPosition Make sure he doesn't sink
            myAnimator.SetFloat("VSpeed", 0.0f);

            Vector3 playerPosition = player.transform.position;
            Vector3 otherPosition  = transform.position;
            otherPosition.y = playerPosition.y;

            var targetRotation = Quaternion.LookRotation(playerPosition - otherPosition);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);

            //Just for Testing
//			if (!splineIsRunning) {
//				splineIsRunning = true;
//				timePast = Time.realtimeSinceStartup;
//
//			} else {
//				if(Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[0]){
//					splineIsRunning = false;
//					timePast = 0;
//					state = 2;
//				}
//			}
            ////////////
        }
        else if (state == 2)
        {
            if (!splineIsRunning)
            {
                otherScript.setSplineObject(SplineRootGroup [1], SplineRootDurationGroup[1]);
                otherScript.FollowSpline();
                print(otherScript.SplineRoot);
                myAnimator.SetFloat("VSpeed", 1.0f);

                splineIsRunning = true;
                timePast        = Time.realtimeSinceStartup;
            }
            else
            {
                if (Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[1])
                {
                    splineIsRunning = false;
                    timePast        = 0;
                    comeHereAudio.Play();
                    state = 3;
                }
            }
        }
        else if (state == 3)
        {
            //this.setPosition Make sure he doesn't sink
            myAnimator.SetFloat("VSpeed", 0.0f);

            Vector3 playerPosition = player.transform.position;
            Vector3 otherPosition  = transform.position;
            otherPosition.y = playerPosition.y;

            var targetRotation = Quaternion.LookRotation(playerPosition - otherPosition);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);

            //Just for Testing
//			if (!splineIsRunning) {
//				splineIsRunning = true;
//				timePast = Time.realtimeSinceStartup;
//
//			} else {
//				if(Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[0]){
//					splineIsRunning = false;
//					timePast = 0;
//					state = 2;
//				}
//			}
            ////////////
        }
        else if (state == 4)
        {
            if (!splineIsRunning)
            {
                otherScript.setSplineObject(SplineRootGroup [2], SplineRootDurationGroup[2]);
                otherScript.FollowSpline();
                print(otherScript.SplineRoot);
                myAnimator.SetFloat("VSpeed", 1.0f);

                splineIsRunning = true;
                timePast        = Time.realtimeSinceStartup;
            }
            else
            {
                if (Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[2])
                {
                    splineIsRunning = false;
                    timePast        = 0;
                    state           = 5;
                }
            }
        }
        else if (state == 5)
        {
            //this.setPosition Make sure he doesn't sink
            myAnimator.SetFloat("VSpeed", 0.0f);

            Vector3 playerPosition = player.transform.position;
            Vector3 otherPosition  = transform.position;
            otherPosition.y = playerPosition.y;

            var targetRotation = Quaternion.LookRotation(playerPosition - otherPosition);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);

            if (!audioPlayed)
            {
                enoughRocksAudio.Play();
                placeFlagAudio.Play(180810);
                audioPlayed = true;
            }

            //Just for Testing
//			if (!splineIsRunning) {
//				splineIsRunning = true;
//				timePast = Time.realtimeSinceStartup;
//
//			} else {
//				if(Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[0]){
//					splineIsRunning = false;
//					timePast = 0;
//					state = 2;
//				}
//			}
            ////////////
        }
//        else if(state == 6){
//			if (!splineIsRunning) {
//
//				otherScript.setSplineObject (SplineRootGroup [3], SplineRootDurationGroup[3]);
//				otherScript.FollowSpline ();
//				print (otherScript.SplineRoot);
//				myAnimator.SetFloat ("VSpeed", 1.0f);
//
//				splineIsRunning = true;
//				timePast = Time.realtimeSinceStartup;
//
//			} else {
//				if(Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[3]){
//					splineIsRunning = false;
//					timePast = 0;
//					state = 7;
//				}
//			}
//		} else if(state == 7){
//			//this.setPosition Make sure he doesn't sink
//			myAnimator.SetFloat ("VSpeed", 0.0f);
//
//			var targetRotation = Quaternion.LookRotation(player.transform.position - transform.position);
//			transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);
//
//			//Just for Testing
////			if (!splineIsRunning) {
////				splineIsRunning = true;
////				timePast = Time.realtimeSinceStartup;
////
////			} else {
////				if(Time.realtimeSinceStartup - timePast >= SplineRootDurationGroup[0]){
////					splineIsRunning = false;
////					timePast = 0;
////					state = 2;
////				}
////			}
//			////////////
//		}
    }