Exemplo n.º 1
0
 public DrawableTexture(String textureLabel, GameObject parent)
 {
     this.texture = AssetManager.getAssetTexture(textureLabel);
     this.parent = parent;
     this.size = new Vector2(texture.width, texture.height);
     this.filter = Color.White;
     this.layer = 0f;
 }
Exemplo n.º 2
0
 public DrawableText(AssetSpriteFont font, GameObject parent, String text, Color color)
 {
     this.font = font;
     this.parent = parent;
     this.text = text;
     this.filter = color;
     scale = Vector2.One;
 }
Exemplo n.º 3
0
 public DrawableTexture(AssetTexture texture, GameObject parent)
 {
     this.texture = texture;
     this.parent = parent;
     this.size = new Vector2(texture.width, texture.height);
     this.filter = Color.White;
     this.layer = 0f;
 }
        public DrawableTextureArrayAsStrip(AssetTexture[] textures, GameObject parent)
        {
            if (textures.Length == 0)
                throw new Exception("Attempt at creating a DrawableTexstureStripAsArray with an empty AssetTexture array");

            this.textures = textures;
            this.parent = parent;
            this.size = new Vector2(textures[0].width, textures[0].height);
            this.filter = Color.White;
            this.layer = 0f;
            this.period = 1f;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Animate position, rotation and size. (GameObject must implement Resizable)
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="originalPosition"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="originalRotation"></param>
        /// <param name="destinationRotation"></param>
        /// <param name="originalSize"></param>
        /// <param name="destinationSize"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public LoopingAnimation(
            World world, 
            GameObject targetObject, 
            Vector2 originalPosition, 
            Vector2 destinationPosition,
            float originalRotation,
            float destinationRotation,
            Vector2 originalSize,
            Vector2 destinationSize,
            float loopTime, 
            InterpolationType 
            interpolationType, 
            bool start,
            float initialPhase
            )
            : base(world)
        {
            target = targetObject;

            if (!(target is Resizable))
                throw new Exception("Attempt at resizing a unresizable object. (Implement Resizable interface)");

            started = start;
            running = start;
            ended = false;

            this.looptime = loopTime;
            this.initialPhase = initialPhase;

            interpolPosition = true;
            interpolRotation = true;
            interpolSize = true;

            this.interpolationType = interpolationType;

            this.originalPosition = originalPosition;
            this.destinationPosition = destinationPosition;
            this.originalRotation = originalRotation;
            this.destinationRotation = destinationRotation;
            this.originalSize = originalSize;
            this.destinationSize = destinationSize;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Animate position.
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="originalPosition"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public Animation(
            World world,
            GameObject targetObject,
            Vector2 originalPosition,
            Vector2 destinationPosition,
            float duration,
            InterpolationType
            interpolationType,
            bool start
            )
            : base(world)
        {
            target = targetObject;

            started = start;
            running = start;
            ended = false;

            lifetime = duration;

            interpolPosition = true;
            interpolRotation = false;
            interpolSize = false;

            this.originalPosition = originalPosition;
            this.destinationPosition = destinationPosition;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Animate to destination rotation, position and size.
        /// </summary>
        /// <param name="world"></param>
        /// <param name="targetObject"></param>
        /// <param name="destinationPosition"></param>
        /// <param name="destinationRotation"></param>
        /// <param name="destinationSize"></param>
        /// <param name="duration"></param>
        /// <param name="interpolationType"></param>
        /// <param name="start"></param>
        public Animation(
            World world,
            GameObject targetObject,
            Vector2 destinationPosition,
            float destinationRotation,
            Vector2 destinationSize,
            float duration,
            InterpolationType
            interpolationType,
            bool start
            )
            : base(world)
        {
            target = targetObject;

            if (!(target is Resizable))
                throw new Exception("Attempt at resizing a unresizable object. (Implement Resizable interface)");

            started = start;
            running = start;
            ended = false;

            lifetime = duration;

            interpolPosition = true;
            interpolRotation = true;
            interpolSize = true;

            this.originalPosition = target.position;
            this.destinationPosition = destinationPosition;
            this.originalRotation = target.rotation;
            this.destinationRotation = destinationRotation;
            this.originalSize = ((Resizable)target).getSize();
            this.destinationSize = destinationSize;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Adds the object to the world removal list and removes it without destroying it at the end of the first world Update cycle to occur.
 /// </summary>
 /// <param name="gameObject">The GameObject to be removed from the list.</param>
 public virtual void RemoveObject(GameObject gameObject)
 {
     objectRemoveList.Add(gameObject);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Adds the object to the world addition list and adds it at the end of the first world Update cycle to occur.
 /// </summary>
 /// <param name="gameObject">The GameObject to be added.</param>
 public virtual void AddObject(GameObject gameObject)
 {
     objectAddList.Add(gameObject);
 }
Exemplo n.º 10
0
 public void setAnchor(GameObject gameObject)
 {
     this.anchor = gameObject;
 }