public HumanPlayer(UnityView view, InputDevice inputDevice, TopDownActionCamera camera)
        {
            this.view        = view;
            this.inputDevice = inputDevice;
            actions          = TopDownActions.CreateWithJoystickBindings();
            actions.Device   = inputDevice;
            GameObject  cursorObject = new GameObject();
            CameraFocus focus        = cursorObject.AddComponent <CameraFocus> ();

            focus.weight = 1f;
            cursor       = cursorObject.AddComponent <BuildCursor> ();
            this.camera  = camera;
            camera.SetFocus(cursor.gameObject.GetComponent <CameraFocus>());
            cursor.AssertControl(actions, this);
            SetState(ControlState.BUILDING_GAME);
        }
    public static void FocusCameraOn(Entity entity, TopDownActionCamera cam)
    {
        if (viewer == null || viewer.topDownActionCam == null || entity == null || !displaysMap.ContainsKey(entity))
        {
            return;
        }
        GameObject view = displaysMap [entity];

        if (view == null)
        {
            return;
        }
        UnityEditor.Selection.activeGameObject = view;
        CameraFocus focus = view.GetComponent <CameraFocus> ();

        if (focus == null)
        {
            return;
        }
        cam.SetFocus(focus);
    }
    static TopDownActionCamera AddCamera()
    {
        GameObject          cameraFocus      = GameObject.Instantiate(viewer.cameraPrototype);
        TopDownActionCamera cameraController = cameraFocus.GetComponentInChildren <TopDownActionCamera> ();
        Camera cameraComponent = cameraFocus.GetComponentInChildren <Camera> ();

        cameras.Add(cameraController);
        if (cameras.Count == 2)
        {
            var mainCam = viewer.topDownActionCam.gameObject.GetComponent <Camera> ();
            mainCam.rect         = new Rect(0f, 0f, .5f, 1f);
            cameraComponent.rect = new Rect(.5f, 0f, .5f, 1f);
            //2[|]
        }
        else
        {
            //TODO
            //3-4[+]
            //6[-|-|-]
            //8[+|+]
            int numPlayers = 4;
        }
        return(cameraController);
    }
        public void UpdateBuildControls()
        {
            if (following)
            {
                if (cursor != null && entity != null)
                {
                    var homonid = UnityView.GetHomonid(entity);
                    if (homonid != null)
                    {
                        cursor.transform.position = homonid.transform.position;
                    }
                }
                if (actions.Move.Vector.magnitude > 1E-4)
                {
                    following = false;
                    UnityView.viewer.topDownActionCam.SetFocus(cursor.gameObject.GetComponent <CameraFocus>());
                }
            }

            if (actions.Back.WasPressed)
            {
                SetState(ControlState.ACTION_GAME);
            }
            if (actions.SpeechUp.WasPressed)
            {
                SetState(ControlState.ACTION_GAME);
            }
            if (actions.SpeechLeft.WasPressed)
            {
                //previous entity, move to and lock on until the camera is panned
            }
            if (actions.SpeechRight.WasPressed)
            {
                //next entity, move to and lock on until the camera is panned
            }
            if (actions.Primary.WasPressed)
            {
                entity = UnityView.GetNextEntity(entity);
                //TODO fix this
                UnityView.FocusCameraOn(entity, camera);
                following = true;
            }

            if (actions.Secondary.WasPressed)
            {
                entity = UnityView.GetPrevEntity(entity);
                //TODO fix this
                UnityView.FocusCameraOn(entity, camera);
                following = true;
            }

            if (actions.TriggerAction)
            {
                TopDownActionCamera cam = UnityView.GetCamera(this);
                if (cam == null)
                {
                    return;
                }
                cam.Zoom(1f / GetZoom());
            }

            if (actions.LockOn)
            {
                TopDownActionCamera cam = UnityView.GetCamera(this);
                if (cam == null)
                {
                    return;
                }
                cam.Zoom(GetZoom());
            }
        }