Beispiel #1
0
        private static void MonoGameOnInitialize(object sender, EventArgs eventArgs)
        {
            Resources = new ResourcesManager();

            Platform.Initialize();

            Logger.Log("Rise", LoggerLevel.Info, "Initializing modules...");

            Controller = new Controller();
            Pointing   = new Pointing();
            Input      = new LegacyInputManager();

            Sound   = new SoundManager();
            Graphic = new GraphicManager(MonoGame.Graphics, MonoGame.GraphicsDevice);
            Scene   = new SceneManager();
            Ui      = new UiManager();
            Debug   = new DebugManager();

            _initializeAction?.Invoke();

            Scene.Initialize();
            Input.Initialize();

            Scene.Switch(_startScene);

            Config.Apply();

            Graphic.AllowUserResizing();
        }
    public void Awake()
    {
        instance = this;
        Application.targetFrameRate = 60;         //iOS by default runs 30fps

        //retrieve screen scale (iOS operates in lowDPI mode)
        nativeTouchScale = ForceTouchPlugin.GetScaleFactor();

        //checks whether current device supports TouchRadius (iOS 8 and above)
        supportsTouchRadius = ForceTouchPlugin.SupportsTouchRadius();

        //prepare to store touches
        touches = new List <NativeTouch> ();
    }
Beispiel #3
0
        private void FixedUpdate()
        {
            if (!CanMove() && IsMoving())
            {
                StopMoving();
            }

            DirectionButton dir = LegacyInputManager.GetPressedDirectionButton();

            if (!IsMoving() && dir == DirectionButton.NONE)
            {
                return;
            }

            TriggerDirectionButton(dir);
        }
        void Update()
        {
            ActionButton    action    = LegacyInputManager.GetPressedActionButton();
            DirectionButton dir       = m_animationController.GetLastAnimationDirection();
            Vector3         dirVector = LegacyInputManager.GetDirectionButtonVector(dir);
            RaycastHit2D    hit       = CheckInteractableRaycast(dirVector);

            if (!hit || !hit.collider || !hit.collider.gameObject.HasComponent <Interactable>())
            {
                Debug.DrawRay(transform.position, dirVector, Color.red);
                Debug.DrawRay(transform.position, hit.point, Color.blue);
                return;
            }

            Debug.DrawRay(transform.position, dirVector, Color.green);
            Debug.DrawRay(transform.position, hit.point, Color.blue);

            hit.collider.gameObject.GetComponent <Interactable>()
            .Interact(new InteractionContext(dir, action, m_DialogManager));
        }
Beispiel #5
0
        private static void MonoGameOnInitialize(object sender, EventArgs eventArgs)
        {
            Ressource = new RessourceManager();

            Platform.Initialize();

            Logger.Log("Rise", LoggerLevel.Info, "Initializing modules...");

            Keyboard   = new KeyboardInputManager();
            Controller = new Controller();
            Pointing   = new Pointing();
            Input      = new LegacyInputManager();

            Graphic = new GraphicManager(MonoGame.Graphics, MonoGame.GraphicsDevice);
            Scene   = new SceneManager();
            Ui      = new UiManager();
            Debug   = new DebugManager();

            _initializeAction?.Invoke();

            Graphic.ResetRenderTargets();
            Scene.Initialize();
            Input.Initialize();

            if (Platform.GetPlatformName() != "Android")
            {
                Keyboard.Initialize(300, 5);
            }

            Scene.Switch(_startScene);

            if (Platform.Family == PlatformFamily.Desktop)
            {
                Graphic.SetSize(1366, 768);
            }
        }
Beispiel #6
0
        public void UpdateAnimation(DirectionButton dir)
        {
            var pos = LegacyInputManager.GetDirectionButtonVector(dir);

            UpdateAnimation(pos, pos);
        }