示例#1
0
    // Initialize function
    public void Start()
    {
        platformSectionList        = new InterpolatedValueList(sectionList.hasLoop, sectionList.loopBackToIndex);
        platformSectionList.values = sectionList.values;
        platformSectionList.Init();

        sceneSectionList        = new InterpolatedValueList(sectionList.hasLoop, sectionList.loopBackToIndex);
        sceneSectionList.values = sectionList.values;
        sceneSectionList.Init();
    }
示例#2
0
    // Initialize function
    public void Init()
    {
        // rigidbody should no longer use gravity, be kinematic, and freeze all constraints
        Rigidbody playerRigibody = GetComponent <Rigidbody>();

        if (playerRigibody != null)
        {
            if (playerRigibody.useGravity)
            {
                Debug.LogError("The rigidbody no longer needs to use gravity. Disabling.");
                playerRigibody.useGravity = false;
            }
            if (!playerRigibody.isKinematic)
            {
                Debug.LogError("The rigidbody should be kinematic. Enabling.");
                playerRigibody.isKinematic = true;
            }
            if (playerRigibody.constraints != RigidbodyConstraints.FreezeAll)
            {
                Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics.");
                playerRigibody.constraints = RigidbodyConstraints.FreezeAll;
            }
        }

        platformLayer = 1 << LayerMask.NameToLayer("Platform");
        floorLayer    = 1 << LayerMask.NameToLayer("Floor");
        wallLayer     = LayerMask.NameToLayer("Wall");

        thisTransform   = transform;
        capsuleCollider = GetComponent <CapsuleCollider>();
        playerAnimation = GetComponent <PlayerAnimation>();
        playerAnimation.Init();

        startPosition = thisTransform.position;
        startRotation = thisTransform.rotation;

        forwardSpeeds.Init();
        // determine the fastest and the slowest forward speeds
        forwardSpeeds.GetMinMaxValue(out minForwardSpeed, out maxForwardSpeed);
        forwardSpeedDelta = maxForwardSpeed - minForwardSpeed;
        if (forwardSpeedDelta == 0)
        {
            playerAnimation.SetRunSpeed(1, 1);
        }

        ResetValues();
        enabled = false;
    }
示例#3
0
 // Initialize function
 public void Init()
 {
     appearProbabilities.Init();
     nonappearProbabilities.Init();
 }