Exemple #1
0
        public override void OnDetached(AbstractEntity entity)
        {
            Game.Instance.Simulation.CurrentUpdateQueue.AddUpdate(new RemoveRenderableUpdate((Renderable)Updatable));

            if (entity.HasVector3(CommonNames.Position))
            {
                entity.GetVector3Attribute(CommonNames.Position).ValueChanged -= PositionChanged;
            }
            if (entity.HasVector3(CommonNames.Velocity))
            {
                entity.GetVector3Attribute(CommonNames.Velocity).ValueChanged -= VelocityChanged;
            }
            if (entity.HasBool(CommonNames.Dead))
            {
                entity.GetBoolAttribute(CommonNames.Dead).ValueChanged -= DeadChanged;
            }

            base.OnDetached(entity);
        }
Exemple #2
0
        public override void OnDetached(AbstractEntity entity)
        {
            Game.Instance.Simulation.CurrentUpdateQueue.AddUpdate(new RemoveRenderableUpdate((Renderable)Updatable));

            if (entity.HasVector3(CommonNames.Position))
            {
                entity.GetVector3Attribute(CommonNames.Position).ValueChanged -= PositionChanged;
            }
            if (entity.HasQuaternion(CommonNames.Rotation))
            {
                entity.GetQuaternionAttribute(CommonNames.Rotation).ValueChanged -= RotationChanged;
            }
            if (entity.HasVector3(CommonNames.Scale))
            {
                entity.GetVector3Attribute(CommonNames.Scale).ValueChanged -= ScaleChanged;
            }

            base.OnDetached(entity);
        }
        public override void OnAttached(AbstractEntity entity)
        {
            base.OnAttached(entity);

            if (entity.HasVector3(CommonNames.Position))
            {
                entity.GetVector3Attribute(CommonNames.Position).ValueChanged += PositionChanged;
            }

            Game.Instance.Simulation.CurrentUpdateQueue.AddUpdate(new AddRenderableUpdate((Renderable)Updatable));
        }
        public override void OnAttached(AbstractEntity entity)
        {
            base.OnAttached(entity);

            if (entity.HasVector3(CommonNames.Scale))
            {
                entity.GetVector3Attribute(CommonNames.Scale).ValueChanged += ScaleChanged;
            }

            if (entity.HasQuaternion(CommonNames.Rotation))
            {
                entity.GetQuaternionAttribute(CommonNames.Rotation).ValueChanged += RotationChanged;
            }

            if (entity.HasVector3(CommonNames.Position))
            {
                entity.GetVector3Attribute(CommonNames.Position).ValueChanged += PositionChanged;
            }

            Game.Instance.Simulation.OnLevelLoaded             += LevelLoaded;
            Game.Instance.Simulation.EntityManager.EntityAdded += EntityAdded;

            Game.Instance.Simulation.CurrentUpdateQueue.AddUpdate(new AddRenderableUpdate((Renderable)Updatable));
        }