Beispiel #1
0
    // Use this for initialization
    public void Start()
    {
        if (NetworkHelper.IsOwnerSide(networkView))
        {
            var identity = GetComponent <PlayerIdentity>();

            if (!identity.IsHuman)
            {
                //AI
                InputBroker = GetComponent <PlayerAI>().GetInputBroker();
            }
            else
            {
                //Human
                if (SystemInfo.supportsAccelerometer)
                {
                    //Mobile platform
                    InputBroker = new MobileInputBroker();
                }
                else
                {
                    //Desktop platform
                    InputBroker = new DesktopInputBroker();
                }
            }
        }
        else
        {
            //Remote, don't care
            InputBroker = null;
        }
    }
Beispiel #2
0
    /// <summary>
    /// Initialize the input proxy.
    /// </summary>
    public void Initialize(short controller_id)
    {
        var AI = GetComponent <PlayerAI>();

        if (AI)
        {
            InputBroker = AI;                                               // AI.
        }
        else if (SystemInfo.supportsAccelerometer)
        {
            InputBroker = new MobileInputBroker();                          // Mobile.
        }
        else
        {
            InputBroker = new DesktopInputBroker(controller_id);            // Desktop.
        }
    }