Ejemplo n.º 1
0
        public CameraGoToScene(RunScene node, IEntity targetObject, Vec3 stance) : base(node)
        {
            _targetPos        = targetObject.GetPos() + stance;
            _targetForwardDir = -stance.GetNormalized();

            GameFramework.RegisterForUpdate(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext = new UpdateContext();
            _soundEnabled  = true;

            _touchInfo         = new TouchInfo();
            _touchInfo.touchId = 0;
            _lastKeyDownTime   = new Dictionary <KeyId, float>();

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            Timers.inst.Add(5, 0, RunTextureCollector);
            GameFramework.RegisterForUpdate(this);
            GameFramework.RegisterForRender(this);

            _focusRemovedDelegate = OnFocusRemoved;

            Renderer.ResolutionChanged += OnResolutionChanged;
            OnResolutionChanged(0, 0);

            _mouseEventListener = new MouseEventListener();
            Global.gEnv.pHardwareMouse.AddListener(_mouseEventListener);

            Input.OnKey += OnKeyEvents;
        }
Ejemplo n.º 3
0
 private Game()
 {
     GameFramework.RegisterForUpdate(this);
     Mouse.ShowCursor();
     Engine.EngineReloaded += CreateUi;
     CreateUi();
 }
Ejemplo n.º 4
0
        public SampleApp()
        {
            Instance = this;
            CreateUI();

            GameFramework.RegisterForUpdate(this);
            Input.OnKey += OnKey;
        }
Ejemplo n.º 5
0
        public Timer(float time, Action onTimerExpired = null)
        {
            GameFramework.RegisterForUpdate(this);

            this.timeToLive     = time;
            startTime           = Global.gEnv.pTimer.GetCurrTime();
            this.onTimerExpired = onTimerExpired;
        }
Ejemplo n.º 6
0
    public IconManager()
    {
        _items         = new List <LoadItem>();
        _pool          = new Hashtable();
        _basePath      = Engine.DataDirectory + "/Icons/";
        _lastCheckPool = Engine.Timer.GetCurrTime();

        GameFramework.RegisterForUpdate(this);
    }
Ejemplo n.º 7
0
        public WorldMouse()
        {
            Mouse.OnLeftButtonDown  += OnLeftButtonDown;
            Mouse.OnLeftButtonUp    += OnLeftButtonUp;
            Mouse.OnRightButtonDown += OnRightButtonDown;
            Mouse.OnRightButtonUp   += OnRightButtonUp;

            GameFramework.RegisterForUpdate(this);
        }
Ejemplo n.º 8
0
        private Game()
        {
            // The server doesn't support rendering UI and receiving input, so initializing those system is not required.
            if (Engine.IsDedicatedServer)
            {
                return;
            }

            GameFramework.RegisterForUpdate(this);
        }
Ejemplo n.º 9
0
        public Timers()
        {
            _inst = this;

            _items    = new Dictionary <TimerCallback, Anymous_T>();
            _toAdd    = new Dictionary <TimerCallback, Anymous_T>();
            _toRemove = new List <Anymous_T>();
            _pool     = new List <Anymous_T>(100);

            GameFramework.RegisterForUpdate(this);
        }
Ejemplo n.º 10
0
        private Game()
        {
            // The server doesn't support rendering UI and receiving input, so initializing those system is not required.
            if (Engine.IsDedicatedServer)
            {
                return;
            }

            Engine.EngineUnloading += DestroyUI;
            Engine.EngineReloaded  += CreateUI;
            CreateUI();

            GameFramework.RegisterForUpdate(this);

            Input.OnKey += OnKey;
        }
Ejemplo n.º 11
0
        public SydewinderApp()
        {
            AudioManager.PlayTrigger("game_start");

            GameFramework.RegisterForUpdate(this);
            Instance = this;

            // Initialize highscore functionality.
            _gameData = new GameData();

            // _Cry3DEngine_cs_SWIGTYPE_p_ITimeOfDay.SetTime won't work - therefore use console to set time to 7 am.
            Engine.Console.ExecuteString("e_TimeOfDay 24");

            // We are in space, so use (almost) zero gravity (zero gravity would disable physics)
            Engine.Console.ExecuteString("p_gravity_z 0.001");

            // Hook on to Key input.
            Input.OnKey += Input_OnKey;

            _totalGameTime = 0;
            State          = GameState.Finished;

            Camera.Position         = new Vector3(145f, 635f, 70f);
            Camera.ForwardDirection = new Vector3(-1f, 0f, 0f);

            // Initialize Highscore with file name.
            Highscore.InitializeFromFile(HIGHSCORE_URL);

            GameOver += showHighscore =>
            {
                // Reset field of view to ehance 3D look.
                Camera.FieldOfView = 60f;

                UI.MainMenu.SetInactive();
                if (showHighscore)
                {
                    UI.MainMenu.SetupHighscoreMenuPerspective();
                }
                else
                {
                    UI.MainMenu.SetupMainMenuPerspective();
                }
            };

            InitializeMainMenu();
        }
Ejemplo n.º 12
0
 public EyeTrackerControl()
 {
     GameFramework.RegisterForUpdate(this);
     Mouse.SetOverride(this);
     Input.OnKey += (e) =>
     {
         if (e.KeyDown(EKeyId.eKI_LCtrl) && !_leftPressed)
         {
             LeftButtonDown(_eyeX, _eyeY);
             _leftPressed = true;
         }
         if (e.KeyUp(EKeyId.eKI_LCtrl) && _leftPressed)
         {
             LeftButtonUp(_eyeX, _eyeY);
             _leftPressed = false;
         }
     };
 }
Ejemplo n.º 13
0
        void Setup <T>(string identity, GameObject target, Action <T> onAddEffect = null) where T : Effect
        {
            if (target == null)
            {
                Destroy();
                return;
            }

            this.target = target;

            // Assign default parameters
            parameters = new EffectControllerParams();

            GameFramework.RegisterForUpdate(this);

            // Add the Effect
            effect = target.AddComponent <T>();
            onAddEffect?.Invoke(effect as T);
            effect.Initialize(identity);
        }
Ejemplo n.º 14
0
        private Game()
        {
            // The server doesn't support rendering UI and receiving input, so initializing those system is not required.
            if (Engine.IsDedicatedServer)
            {
                return;
            }


            Mouse.ShowCursor();

            GameFramework.RegisterForUpdate(this);

            Input.OnKey += OnKey;

            /*if(!Engine.IsSandbox)
             * {
             *      Engine.Console.ExecuteString("map example", false, true);
             * }*/


            GRoot.inst.AddChild(new MenuScene());
        }
Ejemplo n.º 15
0
 public TurretRotatorTweener()
 {
     GameFramework.RegisterForUpdate(this);
 }
Ejemplo n.º 16
0
 internal Renderer()
 {
     _lastWidth  = ScreenWidth;
     _lastHeight = ScreenHeight;
     GameFramework.RegisterForUpdate(this);
 }
Ejemplo n.º 17
0
 internal SceneManager()
 {
     GameFramework.RegisterForUpdate(this);
 }
Ejemplo n.º 18
0
 static void Init()
 {
     _inited = true;
     _engine = new TweenEngine();
     GameFramework.RegisterForUpdate(_engine);
 }