Ejemplo n.º 1
0
        public GameObject(string name)
        {
            Id   = new ObjectID();
            Name = name;

            _components = new Dictionary <Type, GameComponent>();
            Minima.GetInstance().GameObjectManager.AddGameObject(this);
        }
Ejemplo n.º 2
0
        public override void OnUpdate(GameObject gameObject)
        {
            var a = gameObject.GetComponent <RenderComponent>();
            var b = gameObject.GetComponent <TransformComponent>();
            var s = (Sprite)a.Drawable;

            if (s.GetGlobalBounds().Intersects(Minima.GetInstance().Camera.GetView().Viewport))
            {
                //if (IsInView(b.LocalPosition, s.TextureRect))
                a.Drawable.Draw(Minima.GetInstance().Window, b._it.Transform);
            }
        }
Ejemplo n.º 3
0
        internal void Update()
        {
            OnUpdateStart();
            var objects = Minima.GetInstance().ObjectBuffer.GetGameObjects(Components.ToArray());

            for (var index = 0; index < objects.Count; index++)
            {
                var a = Minima.GetInstance().GameObjectManager.GetGameObjectByID(objects[index]);
                OnUpdate(a);
            }

            OnUpdateEnd(objects);
        }
Ejemplo n.º 4
0
        public void Draw()
        {
            RenderStates states = new RenderStates()
            {
                BlendMode = BlendMode.None,
                Transform = Transform.Identity,
                Texture   = _texture,
                Shader    = null
            };

            _batch.Draw(Minima.GetInstance().Window, states);
            var s = new Sprite();

            s.TextureRect = new IntRect(0, 0, 10, 10);
            s.Draw(Minima.GetInstance().Window, new RenderStates()
            {
                BlendMode = BlendMode.None,
                Transform = Transform.Identity,
                Texture   = _texture,
                Shader    = null
            });
            _batch.Clear();
        }
Ejemplo n.º 5
0
 public override void OnUpdateStart()
 {
     Minima.GetInstance().Window.Clear(Color.Black);
 }
Ejemplo n.º 6
0
 internal void Init(GameObject gameObject)
 {
     Minima.GetInstance().ObjectBuffer.AddGameObject(this.GetType(), gameObject);
 }