Exemplo n.º 1
0
        /// <summary>
        /// Creates a new resource object for the given type, position and spriteSheet.
        /// </summary>
        /// <param name="type">The resource type of this resource. Specifies what kind of resource this will represent in the game</param>
        /// <param name="position">The inital position for this resource</param>
        /// <param name="width">The width of the resource on screen</param>
        /// /// <param name="director">Director of the game.</param>
        public MapResource(EResourceType type, Vector2 position, int width, ref Director director) : base(ref director)
        {
            Type             = type;
            AbsolutePosition = position;
            AbsoluteSize     = new Vector2(width, width * 0.6f);

            // maybe needs some tweaks, it was mentioned that more resources is in a relation with bigger resource representation
            // this needs adjustment as soon as we actually do something with resources.
            Amount = width;

            mColor = new Color(Vector3.Multiply(ResourceHelper.GetColor(type).ToVector3(), 0.75f));
            // mColor = ResourceHelper.GetColor(type);
        }
Exemplo n.º 2
0
        /*
         * /// <summary>
         * /// Required if the Resource is on a platform, the Platform is taking care of the Resources not colliding.
         * /// </summary>
         * /// <param name="direction"></param>
         * public void Move(Vector2 direction)
         * {
         *  mVelocity += Geometry.NormalizeVector(direction) * Speed;
         * } // */

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawCircle(AbsolutePosition, 6, 20, ResourceHelper.GetColor(Type), 6, LayerConstants.ResourceLayer);
            spriteBatch.DrawCircle(AbsolutePosition, 7, 20, Color.Black, 1, LayerConstants.ResourceLayer);
        }