void Start()
    {
        if (skeletonManager == null)
        {
            skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager;
            if (!skeletonManager)
            {
                Debug.Log("The scene is missing " + typeof(RUISSkeletonManager) + " script!");
            }
        }

        character = GetComponent <RielesCharacter>();

        skeletonPosition = transform.localPosition;

        //timeBetweenKnees = normalTimeBetweenKnees;
        move = Vector3.zero;
    }
    // Use this for initialization
    void Start()
    {
        if (pcr == null)
        {
            pcr = gameObject.GetComponent <PlayerControllerRieles>();
        }

        // get the transform of the main camera
        if (Camera.main != null)
        {
            cam = Camera.main.transform;
        }
        else
        {
            Debug.LogWarning(
                "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject);
            // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
        }

        // get the third person character ( this should never be null due to require component )
        character = GetComponent <RielesCharacter>();
        move      = Vector3.zero;
        crouch    = false;
    }
Пример #3
0
    public void StartGame(bool withTime, float time, int repetitions, bool useJog, float jogThreshold, float jogTime, bool useCrouch, float crouchThreshold, bool useJump, float jumpThreshold, bool useShifts, int difficulty)
    {
        this.withTime    = withTime;
        totalTime        = time;
        currentTime      = totalTime;
        totalRepetitions = repetitions;
        this.repetitions = totalRepetitions;
        JogThreshold     = jogThreshold;
        CrouchThreshold  = crouchThreshold;
        JumpThreshold    = jumpThreshold;
        JumpBool         = useJump;
        CrouchBool       = useCrouch;
        JogBool          = useJog;
        KinectPlayerController kinectPlayer = player.GetComponent <KinectPlayerController>();

        kinectPlayer.SetParameters(useJog, jogThreshold, jogTime, useCrouch, crouchThreshold, useJump, jumpThreshold);
        kinectPlayer.UpdateRootPosition = useShifts;
        PlayerControllerRieles playerController = player.GetComponent <PlayerControllerRieles>();

        playerController.UpdateX  = useShifts;
        playerController.AutoMove = !useJog;

        RielesCharacter character = player.GetComponent <RielesCharacter>();

        //character.SetCharacterSpeed(playerSpeed);
        this.difficulty = difficulty;

        validIndexes = new ArrayList();
        if (useShifts)
        {
            validIndexes.Add(0); // trains
        }
        if (useJump)
        {
            validIndexes.Add(1); // barrels
        }
        if (useCrouch)
        {
            validIndexes.Add(2); // blocks
        }
        validIndexes.Add(3);     // pickups

        if (useShifts)
        {
            TrackSpawner.ts.trackType = TrackSpawner.TrackType.ThreeLane;
        }
        else
        {
            TrackSpawner.ts.trackType = TrackSpawner.TrackType.SingleLane;
        }

        TrackSpawner.ts.SpawnInitialTracks();
        player.GetComponent <Rigidbody>().useGravity = true;

        if (withTime)
        {
            timerPanel.SetActive(true);
            repetitionsPanel.SetActive(false);
        }
        else
        {
            textRepetitions.text = totalRepetitions.ToString();
            timerPanel.SetActive(false);
            repetitionsPanel.SetActive(true);
        }

        mainPanel.SetActive(true);
        pausePanel.SetActive(true);
        isPlaying = true;
    }