Ejemplo n.º 1
0
        void Awake()
        {
            // NB: This CANNOT be static! (Each function can operate on exactly one controller)
            funcs = new Dictionary <Type, IHandFunction> {
                [typeof(CameraFunction)]      = new CameraFunction(),
                [typeof(FlyFunction)]         = new FlyFunction(),
                [typeof(GrabFunction)]        = new GrabFunction(),
                [typeof(MeasureFunction)]     = new MeasureFunction(),
                [typeof(ModeControlFunction)] = new ModeControlFunction(this),
                [typeof(ModeMenuFunction)]    = new ModeMenuFunction(this),
                [typeof(OrientFunction)]      = new OrientFunction(),
                [typeof(PointFunction)]       = new PointFunction(),
                [typeof(TeleportFunction)]    = new TeleportFunction(),
            };

            activeFuncs     = new HashSet <Type>();
            events          = GetComponent <VRTK_ControllerEvents>();
            tooltips        = GetComponentInChildren <VRTK_ControllerTooltips>();
            currPrimaryMode = currGripMode = 0;

            tooltips.SendMessage("Awake"); // This is super dumb but it prevents an exception from being thrown

            SetEnabled();
        }