Ejemplo n.º 1
0
        public void Update(SceneContext c, GameTime gt)
        {
            foreach (Type t in this.behaviours)
            {
                EntityBehaviour eb = this.behaviourInstances[t];
                if (eb.IsEnabled)
                {
                    eb.Update(c, this, gt);
                }
            }

            foreach (Entity e in this.children)
            {
                e.Update(c, gt);
            }

            if (this.mesh != null)
            {
                this.mesh.Update(gt);
            }

            if (this.material != null)
            {
                this.material.Update(gt);
            }
        }
Ejemplo n.º 2
0
        internal void AddBehaviour(EntityBehaviour eb)
        {
            Type t = eb.GetType();

            if (this.behaviours.Contains(t))
            {
                throw new Exception("Behaviour already added!");
            }

            this.behaviours.Add(t);
            this.behaviourInstances.Add(t, eb);

            eb.Construct(this);
        }