コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        DirectionalAnalogEvent newInput = NewInput;

        if (!newInput.IsEmpty)
        {
            if (PreviousInput.IsEmpty || (newInput.Velocity - PreviousInput.Velocity).sqrMagnitude >= commandAccelerationSquared)
            {
                cmdIntrp.AddToInterpreter(newInput);
                //print (newInput.Region);
            }
            else
            {
                Move(newInput.Velocity);
            }
        }
        else
        {
            if (!PreviousInput.IsEmpty)
            {
                print(cmdIntrp.Interpret());
                cmdIntrp.Flush();
                BeginRecenter();
            }
        }
        PreviousInput = newInput;
    }