Esempio n. 1
0
        /// <summary>
        /// Constructor with three parametres:
        /// Initilize position, velocity, current state of droping object
        /// </summary>
        /// <param name="states"> DropObjectStates object witch store all textures for droping object animation process </param>
        /// <param name="position"> Initial position of droping object </param>
        /// <param name="windowWidth"> Window width </param>
        public DropObject(DropObjectStates states, Vector2 position, SpriteEffects currentSpriteEffect, int windowWidth)
        {
            this.position = position;
            this.states   = states;

            isVisible = false;
            velocity  = new Vector2(0.25f, 5);

            currentState = 0;

            this.currentSpriteEffect = currentSpriteEffect;
            WindowWidth = windowWidth;
        }
Esempio n. 2
0
        public void LoadContent(ContentManager Content)
        {
            actions[(int)ActionType.IDLE]       = new Animation(Content.Load <Texture2D>(@"droid\idle"), position, 3, 100);
            actions[(int)ActionType.GO]         = new Animation(Content.Load <Texture2D>(@"droid\go"), position, 3, 100);
            actions[(int)ActionType.FIGHT]      = new Animation(Content.Load <Texture2D>(@"droid\attack"), position, 3, 100);
            actions[(int)ActionType.JUMP]       = new Animation(Content.Load <Texture2D>(@"droid\fly"), position, 3, 100);
            actions[(int)ActionType.JUMP_FIGHT] = new Animation(Content.Load <Texture2D>(@"droid\jump_attack"), position, 3, 100);

#if DROP
            // Load all possible states of droping object
            states = new DropObjectStates(6);
            states.LoadContent(Content);

            // Initilise set of droping objects
            swordSet = new DropSetOfObjects();
#endif
        }
Esempio n. 3
0
 /// <summary>
 /// Add new objects to list if distance from last shot is bigger then distanceForNewDrop
 /// </summary>
 /// <param name="states"> Stores sprites for drioping animation </param>
 /// <param name="position"> Store current position of sprite, witch droping object </param>
 /// <param name="windowWidth"> window width </param>
 /// <param name="distanceForNewDrop"> distance from last last droping object </param>
 public void Add(DropObjectStates states, Vector2 position, int windowWidth, int distanceForNewDrop, SpriteEffects currentSpriteEffect)
 {
     // If list is null we need to add object in any case
     if (dropObjectList.Count == 0)
     {
         // Add new object and set it state to visible
         dropObjectList.Add(new DropObject(states, position, currentSpriteEffect, windowWidth));
         dropObjectList.First().IsVisible = true;
     }
     else
     {
         // If list is not empty we check distanse from last drop
         if (Math.Abs(dropObjectList.Last().Position.X - position.X) > distanceForNewDrop)
         {
             // Add new object and set it state to visible
             dropObjectList.Add(new DropObject(states, position, currentSpriteEffect, windowWidth));
             dropObjectList.Last().IsVisible = true;
         }
     }
 }