コード例 #1
0
ファイル: MapView.cs プロジェクト: josh-fisher/OpenSAGE
        private void OnScriptingUpdateFinished(object sender, ScriptingSystem scripting)
        {
            _scriptStateContent.Clear();

            _scriptStateContent.AppendLine("Counters:");

            foreach (var kv in scripting.Counters)
            {
                _scriptStateContent.AppendFormat("  {0}: {1}\n", kv.Key, kv.Value);
            }

            _scriptStateContent.AppendLine("Flags:");

            foreach (var kv in scripting.Flags)
            {
                _scriptStateContent.AppendFormat("  {0}: {1}\n", kv.Key, kv.Value);
            }

            _scriptStateContent.AppendLine("Timers:");

            foreach (var kv in scripting.Timers)
            {
                _scriptStateContent.AppendFormat("  {0}: {1} ({2})\n", kv.Key, kv.Value, scripting.Counters[kv.Key]);
            }
        }
コード例 #2
0
ファイル: ScriptingView.cs プロジェクト: lanyizi/OpenSAGE
        private void OnScriptingUpdateFinished(object sender, ScriptingSystem scripting)
        {
            if (!IsVisible)
            {
                return;
            }

            _scriptStateContent.Clear();

            scripting.Dump(_scriptStateContent);
        }
コード例 #3
0
ファイル: MainGame.cs プロジェクト: gantonious/game-stuffs
        private void Initialize()
        {
            audioManager = new AudioManager();
            renderer     = new ImmediateModeRenderer();
            sprites      = new List <Sprite>();
            sources      = new List <Source>();
            entities     = new List <Entity>();

            string script = "";

            using (StreamReader file = new StreamReader("Assets/Scripts/movement_script.lua"))
            {
                script = file.ReadToEnd();
            }

            Entity entity = new Entity(0);

            entity.AddComponent(new Position(0, 0));
            entity.AddComponent(new Input(new KeyboardAndMouse()));
            entity.AddComponent(new Velocity(0, 0));
            entity.AddComponent(new SpriteComponent(new Sprite(0, 0, 20, 20, SceneManager.AssetManager.LoadTexture("Assets/Images/heart.png"))));
            entity.AddComponent(new Player());
            entities.Add(entity);

            for (int i = 1; i < 2000; i++)
            {
                entity = new Entity(i);
                entity.AddComponent(new Position(i * 40, 0));
                entity.AddComponent(new Velocity(0, 1));
                //entity.AddComponent(new SpriteComponent(new Sprite(0, 0, 20, 20, SceneManager.AssetManager.LoadTexture("Assets/Images/heart.png"))));
                entity.AddComponent(new Rain());
                entities.Add(entity);
            }

            movementSystem   = new MovementSystem();
            scriptingSystem  = new ScriptingSystem();
            renderingSystem  = new RenderingSystem(renderer);
            inputSystem      = new InputSystem();
            collisionSystem  = new CollisionSystem();
            collisionHandler = new CollisionHandler();

            sources.Add(new Source(SceneManager.AssetManager.LoadWave("Assets/Audio/main game.wav")));
            sources[0].Play();
            sources[0].SetPosition(350, 200);
            sources[0].ReferenceDistance = 200f;
            //sources[0].SetVelocity(0, 0);
        }