コード例 #1
0
        public void OnAction(Entity entity)
        {
            if ((entity.Mask & MASK) == MASK)
            {
                ComponentGeometry geometryComponent = (ComponentGeometry)entity.FindComponent(ComponentTypes.COMPONENT_GEOMETRY);
                Geometry          geometry          = geometryComponent.Geometry();

                ComponentTransform transformComponent = (ComponentTransform)entity.FindComponent(ComponentTypes.COMPONENT_TRANSFORM);
                //Vector3 position = transformComponent.Position;
                //Vector3 scale = transformComponent.Scale;
                //Vector3 rotation = transformComponent.Rotation;

                //Matrix4 translateMatrix = Matrix4.CreateTranslation(position);
                //Matrix4 scaleMatrix = Matrix4.CreateScale(scale);
                //Matrix4 xRotMatrix = Matrix4.CreateRotationX(rotation.X);
                //Matrix4 yRotMatrix = Matrix4.CreateRotationY(rotation.Y);
                //Matrix4 zRotMatrix = Matrix4.CreateRotationZ(rotation.Z);
                //Matrix4 rotMatrix = xRotMatrix * yRotMatrix * zRotMatrix;

                //Matrix4 world = rotMatrix * scaleMatrix * translateMatrix;
                Matrix4 world = transformComponent.Transform;

                ComponentTexture textureComponent = (ComponentTexture)entity.FindComponent(ComponentTypes.COMPONENT_TEXTURE);
                int texture = textureComponent.Texture;

                Draw(world, geometry, texture);
            }
        }
コード例 #2
0
        public void OnAction(Entity entity)
        {
            if (camera == null)
            {
                return;
            }

            if ((entity.Mask & MASK) == MASK)
            {
                ComponentGeometry  geometryComponent = entity.GetComponent <ComponentGeometry>();
                ComponentTransform transform         = entity.transform;
                ComponentMaterial  materialComponent = entity.GetComponent <ComponentMaterial>();
                ComponentSound     sound             = entity.GetComponent <ComponentSound>();
                if (sound != null)
                {
                    AL.Source(sound.souce[0], ALSource3f.Position, ref transform.position);
                    //sound.playsoundonce(1);
                }


                Draw(transform.GetTransformMatrix(), geometryComponent.Geometry(), materialComponent);
            }
        }