RemovePosition() public method

public RemovePosition ( ImageModel pos ) : void
pos SmashBros.Models.ImageModel
return void
Beispiel #1
0
        /// <summary>
        /// Show the character at bottom of screen when cursor hovers a characterThumb
        /// </summary>
        private void hoverCharacter(int playerIndex, int characterIndex)
        {
            //Get the character model
            CharacterStats chModel = characterModels[characterIndex];

            //Get character pose by using index
            ImageController img = characterImages[characterIndex];

            //Checks if player already has an entry for hovered character
            //Removes the hovered character
            if (characterHover.ContainsKey(playerIndex))
            {
                img.RemovePosition(characterHover[playerIndex]);
            }
            //If not hovered character add playerIndex to dictionary
            else
            {
                characterHover.Add(playerIndex, null);
            }

            ImageModel model = img.AddPosition(playerIndex * 260, 720, playerIndex);

            model.Id = characterIndex;
            img.AnimatePos(model, playerIndex * 260, 450, 300);
            characterHover[playerIndex] = model;

            //characterThumbs[index].Scale = 1.05f;
            characterThumbs[characterIndex].AnimateScale(1.1f, 500);
            characterThumbs[characterIndex].GetAt(0).CurrentRotation = 0.05f;

            img.IsVisible = true;
        }
 /// <summary>
 /// Removes one life for player
 /// and sets the killersIndex
 /// </summary>
 /// <returns><c>true</c>If character has lifes left</returns>
 public bool GotKilled(out int killerIndex)
 {
     if (gameOptions.UseLifes && PlayerStats.LifesLeft != 0)
     {
         PlayerStats.LifesLeft--;
         lifes.RemovePosition(PlayerStats.LifesLeft);
     }
     killerIndex = PlayerStats.LastHitBy;
     return(PlayerStats.LifesLeft != 0);
 }
Beispiel #3
0
        public override void Update(GameTime gameTime)
        {
            //if game is paused then no updates
            if (CurrentState != GameState.GamePause)
            {
                elapsedTime += gameTime.ElapsedGameTime.Milliseconds;
                if (elapsedTime / 1000 > random.Next(minNew, maxNew))
                {
                    addPowerUpToMap();
                }

                //Updates the powerups that havent been picked up yet
                //Removes the powerups that has layn ther to long
                int count = waitingPowerUps.Count();
                for (int i = 0; i < count; i++)
                {
                    PowerUpStatus p = waitingPowerUps[i];
                    p.ElapsedTime += gameTime.ElapsedGameTime.Milliseconds;
                    if (p.ElapsedTime / 1000 > waitMax)
                    {
                        waitingPowerUps.RemoveAt(i);
                        p.Image.DisposBoundBox();
                        powerUpImg.RemovePosition(p.Image);
                        count--;
                    }
                }

                //Updates the powerup that players has, remove then when time left if 0
                count = activePowerUps.Count();
                for (int i = 0; i < count; i++)
                {
                    var p = activePowerUps.ElementAt(i);
                    p.Value.ElapsedTime += gameTime.ElapsedGameTime.Milliseconds;
                    if (p.Value.ElapsedTime / 1000 > p.Value.PowerUp.duration)
                    {
                        p.Value.Player.RemovePowerUp(p.Value.PowerUp);
                        activePowerUps.Remove(p.Key);
                        count--;
                    }
                }
            }
        }
Beispiel #4
0
 private void OnHitAnimationDone(ImageController target, ImageModel imagePosition)
 {
     target.RemovePosition(imagePosition);
 }
Beispiel #5
0
 private void OnHitAnimationDone(ImageController target, ImageModel imagePosition)
 {
     target.RemovePosition(imagePosition);
 }
Beispiel #6
0
 public void EndMove(MoveModel move)
 {
     Img.RemovePosition(move.Img);
 }