void Start()
        {
            ch  = GetComponent <CharacterController>();
            fpi = GetComponent <FPInput>();

#if UNITY_EDITOR
            if (fpi == null)
            {
                print("No Input Module Input Found, Input Modules should be attached to the player and inherit from the FPBaseInput class");
            }
#endif

            aud      = GetComponent <AudioSource>();
            cam      = transform.Find("CamPivot/Camera");
            camPivot = transform.Find("CamPivot");

            desiredState = normal;
            acceleration = desiredState.onGround;
            standing     = true;

            charRotation = transform.localEulerAngles;
            camRotation  = transform.localEulerAngles;

            gravity = maxGravity;
        }
Exemple #2
0
    public void SetFP(byte i_Key, FP i_Value)
    {
        RemoveFP(i_Key);

        FPInput fpInput = new FPInput(i_Key, i_Value);

        m_FPs.Add(fpInput);
    }
Exemple #3
0
    public FP GetFP(byte i_Key)
    {
        int index = GetFPInputIndex(i_Key);

        if (index >= 0)
        {
            FPInput fpInput = m_FPs[index];
            return(fpInput.value);
        }

        return(FP.Zero);
    }
Exemple #4
0
    private int GetFPInputIndex(byte i_Key)
    {
        for (int index = 0; index < m_FPs.Count; ++index)
        {
            FPInput fpInput = m_FPs[index];
            if (fpInput.key == i_Key)
            {
                return(index);
            }
        }

        return(-1);
    }
Exemple #5
0
    public bool GetFPInput(int i_Index, out FPInput o_FPInput)
    {
        if (!IsValidFPIndex(i_Index))
        {
            o_FPInput = new FPInput(0, FP.Zero);
            return(false);
        }

        FPInput fpInput = m_FPs[i_Index];

        o_FPInput = new FPInput(fpInput);
        return(true);
    }
Exemple #6
0
    public bool HasFP(byte i_Key)
    {
        for (int index = 0; index < m_FPs.Count; ++index)
        {
            FPInput fpInput = m_FPs[index];
            if (fpInput.key == i_Key)
            {
                return(true);
            }
        }

        return(false);
    }
Exemple #7
0
 public FPInput(FPInput i_Original)
 {
     m_Key   = i_Original.key;
     m_Value = i_Original.value;
 }