RemoveSprite() public method

public RemoveSprite ( Zprite sprite ) : void
sprite Zprite
return void
Esempio n. 1
0
    public void RemoveHealthbarToUnitDead(GameObject unit)
    {
        GameObject healthBarClient = unit.transform.FindChild("Healthbar").gameObject;

        Sprite healthbarSprite = healthBarClient.GetComponent <HealthbarClient> ().myHealthBarSprite as Sprite;

        HealthbarSpriteManager.RemoveSprite(healthbarSprite);
    }
Esempio n. 2
0
 void FixedUpdate()
 {
     if (Sprites.Count > MaxSprites)
     {
         SpriteManager.RemoveSprite(Sprites[0] as Sprite);
         Sprites.RemoveAt(0);
     }
 }
Esempio n. 3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Char")
     {
         GameController.instance.gainGrudge(grudgeCost / 2);
         sm.RemoveSprite(sprite);
         Destroy(this.gameObject);
     }
 }
        void CustomDestroy()
        {
            SpriteManager.RemoveSpriteFrame(layeredSpriteFrameInstantiatedInCode);
            SpriteManager.RemoveSpriteFrame(unlayeredSpriteFrameInstantiatedInCode);

            SpriteManager.RemoveSprite(managedInvisiblTestSprite1);
        }
Esempio n. 5
0
 private void GameStartStateManage()
 {
     if (gameStartCount > 0 && TimeManager.CurrentTime - gameTimeMarker > 1.0)
     {
         SpriteManager.RemoveSprite(countSprite);
         countSprite = null;
         if (gameStartCount == 4)
         {
             countSprite        = SpriteManager.AddSprite("two.png");
             countSprite.ScaleX = 8;
             countSprite.ScaleY = 8;
         }
         else if (gameStartCount == 3)
         {
             countSprite        = SpriteManager.AddSprite("one.png");
             countSprite.ScaleX = 8;
             countSprite.ScaleY = 8;
         }
         else if (gameStartCount == 2)
         {
             countSprite        = SpriteManager.AddSprite("kill.png");
             countSprite.ScaleX = 8;
             countSprite.ScaleY = 8;
         }
         else
         {
             gameBall = new Ball(1);
             player1  = new Player(1);
             player2  = new Player(2);
         }
         gameStartCount--;
         gameTimeMarker = TimeManager.CurrentTime;
     }
 }
 /// <summary>
 /// Removes teh argument Sprite after it cycles its AnimationChain.
 /// </summary>
 /// <param name="sprite">The Sprite to remove.</param>
 #endregion
 public static void RemoveWhenJustCycled(Sprite sprite)
 {
     if (sprite.JustCycled)
     {
         SpriteManager.RemoveSprite(sprite);
     }
 }
Esempio n. 7
0
        public void UpdateDisplay()
        {
            #region Create the Sprites if needed

            if (mVisible && (mSprite == null || mImageData == null))
            {
                mSprite = SpriteManager.AddSprite((Texture2D)null);
                // mSprite.TextureAddressMode = TextureAddressMode.Clamp; // required on REACH if we're not a power of 2

                mSprite.X            = mXSeed + .5f * (mNumberOfXTiles - 1) * mGridSpacing;
                mSprite.Y            = mYSeed + .5f * (mNumberOfYTiles - 1) * mGridSpacing;
                mSprite.Z            = this.mVisibleDisplayZ;
                mSprite.FlipVertical = true;
                mSprite.ScaleX       = (mNumberOfXTiles) * mGridSpacing / 2.0f;
                mSprite.ScaleY       = (mNumberOfYTiles) * mGridSpacing / 2.0f;

                mImageData = new ImageData(mNumberOfXTiles, mNumberOfYTiles);
            }

            #endregion

            if (Visible)
            {
                ForceUpdateImageData();
            }
            else
            {
                if (mSprite != null)
                {
                    SpriteManager.RemoveSprite(mSprite);
                    mSprite = null;
                }
            }
        }
        public virtual void Destroy()
        {
            // Generated Destroy
            SpriteManager.RemovePositionedObject(this);
            GuiManager.RemoveWindow(this);

            if (VictoryTextLabel != null)
            {
                VictoryTextLabel.Destroy();
                VictoryTextLabel.Detach();
            }
            if (PlayAgainText != null)
            {
                PlayAgainText.Destroy();
                PlayAgainText.Detach();
            }
            if (NoButton != null)
            {
                NoButton.Destroy();
                NoButton.Detach();
            }
            if (YesButton != null)
            {
                YesButton.Destroy();
                YesButton.Detach();
            }
            if (BackgroundSprite != null)
            {
                SpriteManager.RemoveSprite(BackgroundSprite);
            }


            CustomDestroy();
        }
Esempio n. 9
0
 public void Destory(bool _logMsgs = true)
 {
     if (Id != DefaultSprite.Id)
     {
         SpriteManager.RemoveSprite(this, _logMsgs);
     }
 }
Esempio n. 10
0
 public override void Kill(List <GameObject> gameObjects)
 {
     SpriteManager.RemoveSprite(sprite);
     gameObjects.Remove(this);
     player.Locked = false;
     beamsparks.Kill(gameObjects);
 }
Esempio n. 11
0
        private void EmitSmoke()
        {
            var sprite = SpriteManager.AddParticleSprite(SmokeParticles[0].Texture);

            sprite.AnimationChains   = EffectChains;
            sprite.CurrentChainName  = SmokeParticles.Name;
            sprite.Animate           = false;
            sprite.CurrentFrameIndex = FlatRedBallServices.Random.Next(SmokeParticles.Count);

            sprite.TimeCreated  = TimeManager.CurrentTime;
            sprite.TextureScale = 1;
            sprite.UpdateToCurrentAnimationFrame();
            sprite.TextureScale   = -1;
            sprite.ScaleXVelocity = 1.25f;
            sprite.ScaleYVelocity = 1.25f;
            sprite.X              = this.X;
            sprite.Y              = this.Y;
            sprite.Z              = this.Z;
            sprite.ZVelocity      = 50;
            sprite.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            sprite.Drag           = 0;
            sprite.Detach();
            sprite.RotationZ         = FlatRedBallServices.Random.Between(-3.14f, 3.14f);
            sprite.RotationZVelocity = FlatRedBallServices.Random.Between(-0.9f, 0.9f);

            this.emittedSprites.Add(sprite);

            this.Call(() => SpriteManager.RemoveSprite(sprite)).After(particleLife);
        }
Esempio n. 12
0
            public MenuCharacter(string fileName)
            {
                Immovable = true;
                zFileName = fileName;
                SaveHero shero = (SaveHero)Functions.Deserialize(fileName);

                zHeroName = shero.Name;
                Text      = $"{shero.Name}\nLvl{shero.Level.ToString()}";
                zText.RelativePosition.Y += 3;
                zText.RelativePosition.X += 0.5f;
                zText.HorizontalAlignment = HorizontalAlignment.Center;
                var s1 = SetSprite(shero);

                SpriteManager.RemoveSprite(s1);
                zSprite.Texture = s1.Texture;
                zSprite.LeftTextureCoordinate  = 0.333f;
                zSprite.RightTextureCoordinate = 0.667f;
                zSprite.ColorOperation         = ColorOperation.Texture;
                Size    = new Vector2(8, 8);
                OnClick = delegate()
                {
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    m.SelectCharacter(this);
                };
            }
Esempio n. 13
0
            private void DisplayCharSprite(HeroClass c)
            {
                zHeroClass = c;
                Sprite s1 = null;

                if (c == HeroClass.Elf)
                {
                    s1 = Functions.AddSpriteFromAchx(Path.Make(Path.Hero, "elf.achx"));
                    zCharSprite.Text = "Elf";
                }
                else if (c == HeroClass.Knight)
                {
                    s1 = Functions.AddSpriteFromAchx(Path.Make(Path.Hero, "knight.achx"));
                    zCharSprite.Text = "Knight";
                }
                else if (c == HeroClass.Wizard)
                {
                    s1 = Functions.AddSpriteFromAchx(Path.Make(Path.Hero, "wizard.achx"));
                    zCharSprite.Text = "Wizard";
                }
                SpriteManager.RemoveSprite(s1);
                zCharSprite.zSprite.Texture = s1.Texture;
                zCharSprite.zSprite.LeftTextureCoordinate  = 0.333f;
                zCharSprite.zSprite.RightTextureCoordinate = 0.667f;
                zCharSprite.zSprite.ColorOperation         = ColorOperation.Texture;
                zCharSprite.Visible = true;
                zCharSprite.Size    = new Vector2(8, 8);
                zCharSprite.zText.RelativePosition.X  = 0;
                zCharSprite.zText.HorizontalAlignment = HorizontalAlignment.Center;
            }
Esempio n. 14
0
        private void UpdateRoadSprite(Vector3 position, bool showAbove, string chainName)
        {
            Sprite spriteAt = GetRoadSpriteAt(position);

            if (spriteAt == null && showAbove)
            {
                spriteAt                 = new Sprite();
                spriteAt.Position        = position;
                spriteAt.TextureScale    = 1;
                spriteAt.AnimationChains = AnimationChainListFile;

                SpriteManager.AddSprite(spriteAt);
                this.Sprites.Add(spriteAt);
                this.Sprites.SortXInsertionAscending();
            }
            if (spriteAt != null && !showAbove)
            {
                SpriteManager.RemoveSprite(spriteAt);
            }

            if (spriteAt != null)
            {
                spriteAt.CurrentChainName = chainName;
            }
        }
Esempio n. 15
0
        public override void Destroy()
        {
            // Generated Destroy
            base.Destroy();

            if (SpriteInstance != null)
            {
                SpriteManager.RemoveSprite(SpriteInstance);
            }
            if (HandSprite != null)
            {
                SpriteManager.RemoveSprite(HandSprite);
            }
            if (GunRectangle != null)
            {
                ShapeManager.Remove(GunRectangle);
            }
            if (FedoraSprite != null)
            {
                SpriteManager.RemoveSprite(FedoraSprite);
            }


            CustomDestroy();
        }
Esempio n. 16
0
        private void EmitParticle()
        {
            var randomIndex    = FlatRedBallServices.Random.Next(AnimationChainListFile.Count);
            var animationChain = AnimationChainListFile[randomIndex];
            var sprite         = SpriteManager.AddParticleSprite(null);

            sprite.SetAnimationChain(animationChain);
            if (LayerProvidedByContainer != null)
            {
                SpriteManager.AddToLayer(sprite, this.LayerProvidedByContainer);
            }

            sprite.Position = this.Position;
            sprite.X       += PositionSpread - 2 * PositionSpread * (float)FlatRedBallServices.Random.NextDouble();
            sprite.Y       += PositionSpread - 2 * PositionSpread * (float)FlatRedBallServices.Random.NextDouble();

            sprite.XVelocity = -MaxVelocity + 2 * MaxVelocity * (float)FlatRedBallServices.Random.NextDouble();
            sprite.YVelocity = -MaxVelocity + 2 * MaxVelocity * (float)FlatRedBallServices.Random.NextDouble();
            sprite.Drag      = 1;

            sprite.TextureScale = 1;

            var screen = ScreenManager.CurrentScreen;

            // assocaite them with the screen:
            screen.Call(() => SpriteManager.RemoveSprite(sprite)).After(ParticleDuration);
        }
Esempio n. 17
0
 public void ClearLightningSprites()
 {
     while (LightningSpriteList.Count > 0)
     {
         SpriteManager.RemoveSprite(LightningSpriteList.Last());
     }
 }
 /// <summary>
 /// Removes the argument Sprite when it is outside of the default Camera's view (SpriteManager.Camera).
 /// </summary>
 /// <param name="sprite">The Sprite to remove.</param>
 #endregion
 public static void RemoveWhenOutsideOfScreen(Sprite sprite)
 {
     if (SpriteManager.Camera.IsSpriteInView(sprite, false) == false)
     {
         SpriteManager.RemoveSprite(sprite);
     }
 }
Esempio n. 19
0
        private void PerformDeath()
        {
            FlatRedBall.Audio.AudioManager.Play(PlayerBaseDestroyed);

            int numberOfExplosions = 13;

            void PlayExplosions()
            {
                var maxExplosionDistance = 32;

                var sprite = SpriteManager.AddSprite(BigExplosionBase);

                sprite.TextureScale = 1;
                sprite.X            = FlatRedBallServices.Random.Between(X - maxExplosionDistance, X + maxExplosionDistance);;
                sprite.Y            = FlatRedBallServices.Random.Between(Y - maxExplosionDistance, Y + maxExplosionDistance);;
                sprite.Z            = this.Z + 1f;

                this.Call(() => SpriteManager.RemoveSprite(sprite)).After(BigExplosionBase.TotalLength - TimeManager.SecondDifference);
            }

            for (int i = 0; i < numberOfExplosions; i++)
            {
                if (i == 0)
                {
                    PlayExplosions();
                }
                else
                {
                    this.Call(PlayExplosions).After(i * .13);
                }
            }
        }
Esempio n. 20
0
        public static void ClearEngine()
        {
            while (ShapeManager.VisibleCircles.Count != 0)
            {
                ShapeManager.Remove(ShapeManager.VisibleCircles.Last());
            }
            while (ShapeManager.VisibleRectangles.Count != 0)
            {
                ShapeManager.Remove(ShapeManager.VisibleRectangles.Last());
            }
            while (ShapeManager.VisiblePolygons.Count != 0)
            {
                ShapeManager.Remove(ShapeManager.VisiblePolygons.Last());
            }

            while (ShapeManager.VisibleLines.Count != 0)
            {
                ShapeManager.Remove(ShapeManager.VisibleLines.Last());
            }

            while (SpriteManager.AutomaticallyUpdatedSprites.Count != 0)
            {
                SpriteManager.RemoveSprite(SpriteManager.AutomaticallyUpdatedSprites.Last());
            }

            while (TextManager.AutomaticallyUpdatedTexts.Count != 0)
            {
                TextManager.RemoveText(TextManager.AutomaticallyUpdatedTexts.Last());
            }
        }
 /// <summary>
 /// Removes the argument Sprite when its Alpha equals 0.
 /// </summary>
 /// <param name="sprite">The Sprite to remove.</param>
 #endregion
 public static void RemoveWhenInvisible(Sprite sprite)
 {
     if (sprite.Alpha == 0)
     {
         SpriteManager.RemoveSprite(sprite);
     }
 }
Esempio n. 22
0
        public void Destroy()
        {
            ShapeManager.Remove(mCollision);

            SpriteManager.RemoveSprite(mVisibleRepresentation);

            SpriteManager.RemovePositionedObject(this);
        }
 /// <summary>
 /// Removes the argument Sprite if it is opaque.
 /// </summary>
 /// <remarks>
 /// This method is commonly used with Sprites which have a
 /// positive AlphaRate and which should be removed when completely visible.
 /// </remarks>
 /// <param name="si">Sprite to remove.</param>\
 #endregion
 public static void RemoveWhenAlphaIs1(Sprite si)
 {
     // Don't test against 1 because that's inaccurate.  Let's just test a very small range.
     if (si.Alpha > .999f)
     {
         SpriteManager.RemoveSprite(si);
     }
 }
Esempio n. 24
0
 void RemoveAndDisposePreRenderedObjects()
 {
     if (mPreRenderedSprite != null)
     {
         SpriteManager.RemoveSprite(mPreRenderedSprite);
         mPreRenderedSprite = null;
     }
     UnloadPreRenderedTexture();
 }
Esempio n. 25
0
 public void Destroy()
 {
     Collect = true;
     ShapeManager.Remove(Collider);
     SpriteManager.RemoveSprite(Sprite);
     SpriteManager.RemoveSprite(HealthBar);
     TextManager.RemoveText(Label);
     SpriteManager.RemovePositionedObject(this);
 }
Esempio n. 26
0
 private void EndGame()
 {
     if (gameBall.sprite != null)
     {
         SpriteManager.RemoveSprite(gameBall.sprite);
         gameBall.sprite = null;
     }
     player1.remove();
     player2.remove();
 }
Esempio n. 27
0
        void CustomDestroy()
        {
            var spriteCount = WaterCausticSpriteList.Count;

            for (var i = spriteCount - 1; i >= 0; i--)
            {
                var spriteToRemove = WaterCausticSpriteList[i];
                SpriteManager.RemoveSprite(spriteToRemove);
            }
        }
Esempio n. 28
0
        public override void Destroy()
        {
            for (var i = sprites.Count - 1; i > -1; i--)
            {
                SpriteManager.RemoveSprite(sprites[i]);
                sprites[i] = null;
                sprites.RemoveAt(i);
            }

            base.Destroy();
        }
Esempio n. 29
0
 public void Destroy()
 {
     State = MobState.Killed;
     if (Sprite != null)
     {
         SpriteManager.RemoveSprite(Sprite);
     }
     if (Label != null)
     {
         TextManager.RemoveText(Label);
     }
     ShapeManager.Remove(this);
 }
Esempio n. 30
0
        private void TreadRemovalActivity()
        {
            var cameraBottom = Camera.Main.AbsoluteBottomYEdgeAt(0) - 20;

            for (int i = treads.Count - 1; i > -1; i--)
            {
                var tread = treads[i];
                if (tread.Y < cameraBottom)
                {
                    SpriteManager.RemoveSprite(tread);
                }
            }
        }