Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        controller     = GetComponent <CharacterController>();
        anim           = GetComponentInChildren <Animator>();
        attachPoints   = GetComponentsInChildren <AttachPoint>();
        spriteRenderer = GetComponentInChildren <SpriteRenderer>();
        GameMaster.Instance.SetPlayer(this);

        //calculate gravity and velocity from wanted jump height and time to peak
        gravity         = -(2 * maxJumpHeight / Mathf.Pow(timeToJumpPeak, 2));
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpPeak;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
        print("Gravity: " + gravity + " Jump Velocity: " + maxJumpVelocity);
        baseGravity = gravity;

        cameraFollow = Camera.main.GetComponent <CameraFollow>();

        foreach (AttachPoint a in attachPoints)
        {
            a.Owner = this;
        }

        inputBuffer = new InputBufferItem[bufferSize];
        for (int i = 0; i < inputBuffer.Length; i++)
        {
            inputBuffer[i] = new InputBufferItem();
        }
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     InputBuffer = new InputBufferItem[buffersize];
     for (var i = 0; i < InputBuffer.Length; i++)
     {
         InputBuffer[i] = new InputBufferItem();
     }
 }
Пример #3
0
 void InitializeBuffer()
 {
     m_inputList = new List <InputBufferItem>();
     foreach (string s in m_inputListString)
     {
         InputBufferItem newB = new InputBufferItem();
         newB.m_button = s;
         m_inputList.Add(newB);
     }
 }