//List<Polygon> polygons
        public CollisionComponent(GameObject gameObject, List<Polygon> polygons, List<AABB> axisAlignedBoxes)
            : base(gameObject)
        {
            Name = "CollisionComponent";

            this.axisAlignedBoxes = axisAlignedBoxes;
            this.polygons = polygons;
            hasCollided = false;

            if (polygons != null && axisAlignedBoxes != null)
            {
                collisionType = CollisionType.POLYGON_AND_AABB;
                ParentObject.Properties.updateProperty<List<AABB>>("AABB", axisAlignedBoxes);
                ParentObject.Properties.updateProperty<List<Polygon>>("Polygon", polygons);
            }
            else if (polygons != null)
            {
                collisionType = CollisionType.POLYGON;
                ParentObject.Properties.updateProperty<List<Polygon>>("Polygon", polygons);
            }
            else if (axisAlignedBoxes != null)
            {
                collisionType = CollisionType.AABB;
                ParentObject.Properties.updateProperty<List<AABB>>("AABB", axisAlignedBoxes);
            }
            else
            {
                collisionType = CollisionType.NO_TYPE;
            }

            ParentObject.Properties.updateProperty<CollisionType>("CollisionType", collisionType);
            ParentObject.Properties.updateProperty<bool>("HasCollided", hasCollided);
            ParentObject.Properties.updateProperty<bool>("IsCollisionActive", true);
        }
예제 #2
0
        public DepthComponent(GameObject gameObject, float depthPosition)
            : base(gameObject)
        {
            this.depthPosition = depthPosition;

            ParentObject.Properties.updateProperty<float>("DepthPosition", depthPosition);
            ParentObject.Properties.updateProperty<bool>("IsDepthActive", true);
        }
예제 #3
0
        public RenderComponent(GameObject gameObject, Texture2D texture2D, Vector2 position, float rotation, Vector2 origin,
            Vector2 scale, float drawDepth)
            : base(gameObject)
        {
            Name = "RenderComponent";

            IsMouse = false;
            IsMenu = false;
            Rotate = false;
            IsBlending = false;
            BlendingTexture = null;
            BlendingColor = Color.White;
            BlenderName = "";
            BlendingTime = 0.0f;
            BlendingAlphaByte = 0;
            this.drawDepth = drawDepth;

            deltaTime = 0.0f;

            if (texture2D != null)
            {
                int size = texture2D.Width * texture2D.Height;
                originalColor = new Color[size];
                texture2D.GetData<Color>(originalColor);
            }
            else
            {
                originalColor = null;
            }

            ParentObject.Properties.updateProperty<Texture2D>("Texture2D", texture2D);
            ParentObject.Properties.updateProperty<Vector2>("Position", position);
            ParentObject.Properties.updateProperty<float>("Rotation", rotation);
            ParentObject.Properties.updateProperty<Vector2>("Origin", origin);
            ParentObject.Properties.updateProperty<Vector2>("Scale", scale);
            ParentObject.Properties.updateProperty<float>("DrawDepth", this.drawDepth);
            ParentObject.Properties.updateProperty<bool>("IsRenderActive", true);
            ParentObject.Properties.updateProperty<Color>("Color", Color.White);
            ParentObject.Properties.updateProperty<Color[]>("OriginalColor", originalColor);
        }
        public AnimationComponent(GameObject gameObject, Texture2D[] textures, Vector2 position, float rotation, Vector2 origin,
            Vector2 scale, int numberOfAnimations, int[] animationSpeeds, int[] numberOfFrames, int[] numberOfRows)
            : base(gameObject)
        {
            Name = "AnimationComponent";

            animations = new List<Animation>(numberOfAnimations);

            for (int i = 0; i < numberOfAnimations; i++)
            {
                animations.Add(new Animation(textures[i], position, rotation, scale, origin,
                        animationSpeeds[i], numberOfFrames[i], numberOfRows[i]));
            }

            drawDepth = 0.0f;

            ParentObject.Properties.updateProperty<List<Animation>>("Animations", animations);
            ParentObject.Properties.updateProperty<Vector2>("Position", position);
            ParentObject.Properties.updateProperty<float>("Rotation", rotation);
            ParentObject.Properties.updateProperty<Vector2>("Origin", origin);
            ParentObject.Properties.updateProperty<Vector2>("Scale", scale);
            ParentObject.Properties.updateProperty<bool>("IsAnimationActive", true);
        }
 public GameObjectComponent(GameObject parentObject)
 {
     ParentObject = parentObject;
     Name = "NoName";
     Active = true;
 }
 public DrawableGameObjectComponent(GameObject parentObject)
     : base(parentObject)
 {
 }