public void OnHeartFinished(AbstractTween tween)
    {
        FSprite heart = (tween as Tween).target as FSprite;

        heart.alpha = 1.0f;
        heart.RemoveFromContainer();
    }
Exemple #2
0
 override public void HandleRemoved()
 {
     base.HandleRemoved();
     body.RemoveFromContainer();
     shadowSprite.RemoveFromContainer();
     player.OnVillDeath(this);
 }
Exemple #3
0
    private static void HandleExplodeSpriteComplete(AbstractTween tween)
    {
        //爆炸粒子播放完毕后移除Container
        FSprite explodeSprite = (tween as Tween).target as FSprite;

        explodeSprite.RemoveFromContainer();
    }
Exemple #4
0
 void EndMathMode()
 {
     _baseLabel.RemoveFromContainer();
     _deltaLabel.RemoveFromContainer();
     _signIcon.RemoveFromContainer();
     _equalsIcon.RemoveFromContainer();
 }
Exemple #5
0
 public override void HandleRemovedFromContainer()
 {
     playerBlip.RemoveFromContainer();
     shadow.RemoveFromContainer();
     base.HandleRemovedFromContainer();
     hair.RemoveFromContainer();
 }
 public void Remove()
 {
     Futile.atlasManager.UnloadAtlas("InputDisplay_" + cam.cameraNumber);
     offscreenContainer.RemoveFromContainer();
     displaySprite.RemoveFromContainer();
     UnityEngine.Object.Destroy(_rtCam.gameObject);
 }
 public void RemoveFromContainer()
 {
     _back.RemoveFromContainer();
     _front.RemoveFromContainer();
     _rtIndicator.RemoveFromContainer();
     _key?.RemoveFromContainer();
     _keySprite?.RemoveFromContainer();
 }
Exemple #8
0
 public void destroyShip()
 {
     this.RemoveFromContainer();
     healthBar.RemoveFromContainer();
     energyBar.RemoveFromContainer();
     InGamePage.LivingPlayers[player - 1] = false;
     InGamePage.checkForWin();
 }
Exemple #9
0
 public override void HandleRemovedFromStage()
 {
     labelShadow.RemoveFromContainer();
     clockBackground.RemoveFromContainer();
     Futile.instance.SignalUpdate -= Update;
     timeLabel.RemoveFromContainer();
     base.HandleRemovedFromStage();
     label.RemoveFromContainer();
 }
            public void Move()
            {
                // Update RT and camera
                int rtW = Mathf.RoundToInt(_rtBounds.width);
                int rtH = Mathf.RoundToInt(_rtBounds.height);

                if (_rt == null)
                {
                    _rt              = new RenderTexture(rtW, rtH, 16);
                    _rt.filterMode   = FilterMode.Point;
                    _rt.generateMips = false;

                    if (displaySprite != null)
                    {
                        Futile.atlasManager.UnloadAtlas("InputDisplay_" + cam.cameraNumber);
                        displaySprite?.RemoveFromContainer();
                    }

                    FAtlasElement element = Futile.atlasManager.LoadAtlasFromTexture("InputDisplay_" + cam.cameraNumber, _rt).elements[0];
                    displaySprite = new FSprite(element)
                    {
                        anchorX = 0f, anchorY = 0f, alpha = alpha
                    };
                    _rtCam.targetTexture = _rt;
                }

                if (_rt.width != rtW || _rt.height != rtH)
                {
                    _rt.width  = rtW;
                    _rt.height = rtH;
                }

                // Update display sprite
                displaySprite.SetPosition(origin + _rtBounds.min - Vector2.one * 0.5f);

                // Update components
                Vector2 drawOrigin = DrawOrigin;

                _lerpBarBack.x = drawOrigin.x;
                _lerpBarBack.y = drawOrigin.y - 8f;
                _lerpBar.x     = drawOrigin.x;
                _lerpBar.y     = drawOrigin.y - 8f;
                foreach (InputButton button in buttons)
                {
                    button.Move(drawOrigin);
                }
                _analogBack.SetPosition(drawOrigin + _analogRelPos);
                _analogFront.x = drawOrigin.x + _analogRelPos.x + 1f;
                _analogFront.y = drawOrigin.y + _analogRelPos.y + 1f;

                _rtCam.transform.position = (Vector3)(drawOrigin + _rtBounds.center) + Vector3.forward * -10f;
                _rtCam.orthographicSize   = _rtBounds.height / 2f;
            }
Exemple #11
0
        override public void secondarySpecial()
        {
            if (cloned)
            {
                FSprite agentCloud   = new FSprite("Agent_Cloud.png");
                float   currHealth   = health;
                float   currEnergy   = energy;
                float   currShields  = shields;
                float   xPos         = this.x;
                float   yPos         = this.y;
                float   currRotation = rotation;
                Vector2 currVector   = velocity;

                if (frameCountSecondary == 0)
                {
                    //FSprite agentCloud = new FSprite("Agent_Cloud.png");
                    agentCloud.x     = this.x;
                    agentCloud.y     = this.y;
                    agentCloud.scale = 0.5f;
                    InGamePage.instance.AddChild(agentCloud);
                    //InGamePage.Ships.Remove(this);
                    //this.RemoveFromContainer();
                    healthBar.RemoveFromContainer();
                    shieldBar.RemoveFromContainer();
                    energyBar.RemoveFromContainer();
                    //InGamePage.instance.RemoveChild(this);
                }
                else if (frameCountSecondary == 120)
                {
                    InGamePage.instance.RemoveChild(agentCloud);
                    agentCloud.RemoveFromContainer();
                    Ship newAgent1 = Ship.Create(9, player);
                    Ship newAgent2 = Ship.Create(9, player);
                    InGamePage.Ships.Remove(this);
                    InGamePage.Ships.Add(newAgent1);
                    InGamePage.Ships.Add(newAgent2);
                    newAgent1.x = (xPos + Mathf.Cos(rotation));
                    newAgent1.y = (yPos - Mathf.Sin(rotation));
                    newAgent2.x = (xPos - Mathf.Cos(rotation));
                    newAgent2.y = (yPos + Mathf.Sin(rotation));

                    newAgent1.health   = newAgent2.health = currHealth;
                    newAgent1.energy   = newAgent2.energy = currEnergy;
                    newAgent1.shields  = newAgent2.shields = currShields;
                    newAgent1.rotation = newAgent2.rotation = currRotation;
                    newAgent1.velocity = newAgent2.velocity = currVector;
                    InGamePage.instance.AddChild(newAgent1);
                    InGamePage.instance.AddChild(newAgent2);
                }
            }
        }
Exemple #12
0
    void UpdateShouldRemove()
    {
        if (_shouldRemove)
        {
            AddChild(_skullSprite);
            _skullSprite.SetPosition(_scoreLabel.GetPosition());
            _scoreLabel.RemoveFromContainer();

            FSoundManager.PlaySound("UI/ResetToZero");
        }
        else
        {
            AddChild(_scoreLabel);
            _skullSprite.RemoveFromContainer();
        }
    }
Exemple #13
0
    public void RenderUpdate(SpriteLeaser spriteLeaser, WorldCamera camera)
    {
        bool inRange = ((_chunk.coordination + Vector2.one * 0.5f) * Chunk.Length - new Vector2(_chunk.world.player.worldPosition.x, _chunk.world.player.worldPosition.z)).sqrMagnitude < 1024f;

        if (_showing && !inRange)
        {
            spriteLeaser.RemoveFromContainer();
            _showing = false;
        }
        else if (!_showing && inRange)
        {
            _showing = true;
        }

        if (_showing)
        {
            UpdateTileRender(spriteLeaser, camera);

            for (int index = 0; index < _drawTiles.Count; index++)
            {
                Tile    tile   = _drawTiles[index];
                FSprite sprite = spriteLeaser.sprites[index];

                // if (camera.turning)
                SetSpriteByTile(sprite, tile, camera, true);

                bool inScreenRect = spriteLeaser.InScreenRect(sprite);

                if (sprite.container != null && !inScreenRect)
                {
                    sprite.RemoveFromContainer();
                }
                else if (sprite.container == null && inScreenRect)
                {
                    camera.worldContainer.AddChild(sprite);
                }
            }
        }
    }
Exemple #14
0
 public void Destroy()
 {
     holder.RemoveListenForUpdate();
     sprite.RemoveFromContainer();
     UnityEngine.Object.Destroy(gameObject);
 }
    override public void Destroy()
    {
        base.Destroy();

        sprite.RemoveFromContainer();
    }
Exemple #16
0
    public void AddHealth(int health, Vector2 pos)
    {
        for (int i = this.health; i < health; i++)
        {
            FSprite heart = new FSprite("heart");

            heart.SetPosition(pos);
            Vector2 targetPos = hearts.GetPosition();
            switch (i)
            {
                case 0: targetPos.x -= 10; break;
                case 1: break;
                case 2: targetPos.x += 10; break;
            }

            this.AddChild(heart);
            Go.to(heart, .7f, new TweenConfig().floatProp("x", targetPos.x).floatProp("y", targetPos.y).setEaseType(EaseType.QuadOut).onComplete(() => { setHealthSprite(this.health); heart.RemoveFromContainer(); }));
        }
        this.health = health;
    }
Exemple #17
0
 public void TakeDamage(int health)
 {
     for (int i = this.health; i > health; i--)
     {
         FSprite heart = new FSprite("heart");
         heart.SetPosition(hearts.GetPosition());
         switch (i)
         {
             case 1: heart.x -= 10; break;
             case 2: break;
             case 3: heart.x += 10; break;
         }
         this.AddChild(heart);
         Go.to(heart, .7f, new TweenConfig().floatProp("y", -15, true).setEaseType(EaseType.BackOut).onComplete(() => { heart.RemoveFromContainer(); }));
     }
     this.health = health;
     setHealthSprite(health);
 }
Exemple #18
0
        public void HookPageGrafUpdate(On.Menu.SlugcatSelectMenu.SlugcatPage.orig_GrafUpdate orig, SlugcatSelectMenu.SlugcatPage instance, float timeStacker)
        {
            float num   = instance.Scroll(timeStacker);
            float num2  = instance.UseAlpha(timeStacker);
            float depth = instance.slugcatDepth;

            if (instance.HasMark)
            {
                float num3 = Mathf.Lerp(instance.lastMarkAlpha, instance.markAlpha, timeStacker) * num2;
                if (instance.slugcatNumber == 2)
                {
                    num3 *= ((!(instance is SlugcatSelectMenu.SlugcatPageContinue)) ? 0f : Mathf.Pow(Mathf.InverseLerp(4f, 14f, (float)(instance as SlugcatSelectMenu.SlugcatPageContinue).saveGameData.cycle), 3.5f));
                }
                Vector2 a = new Vector2(instance.MidXpos + num * instance.ScrollMagnitude, instance.imagePos.y + 150f) + instance.markOffset;
                a -= instance.slugcatImage.CamPos(timeStacker) * 80f / depth;
                a -= new Vector2(0, artOffset);
                instance.markSquare.x     = a.x;
                instance.markSquare.y     = a.y;
                instance.markSquare.alpha = Mathf.Pow(num3, 0.75f);
                instance.markGlow.x       = a.x;
                instance.markGlow.y       = a.y;
                instance.markGlow.scale   = Mathf.Lerp(3f, 3.3f, Mathf.Pow(num3, 0.2f)) + ((!instance.HasGlow) ? 0f : -0.5f) + Mathf.Lerp(-0.1f, 0.1f, UnityEngine.Random.value) * instance.markFlicker;
                instance.markGlow.alpha   = ((instance.slugcatNumber != 0) ? 0.6f : 0.4f) * Mathf.Pow(num3, 0.75f);
            }
            if (instance.HasGlow)
            {
                float   num4 = Mathf.Lerp(0.8f, 1f, Mathf.Lerp(instance.lastGlowAlpha, instance.glowAlpha, timeStacker)) * num2 * Mathf.Lerp(instance.lastInposition, instance.inPosition, timeStacker);
                Vector2 a2   = new Vector2(instance.MidXpos + num * instance.ScrollMagnitude, instance.imagePos.y) + instance.glowOffset;
                a2 -= instance.slugcatImage.CamPos(timeStacker) * 80f / depth;
                a2 -= new Vector2(0, artOffset);
                instance.glowSpriteB.color = Color.Lerp(instance.effectColor, new Color(1f, 1f, 1f), 0.3f * num4);
                instance.glowSpriteB.x     = a2.x;
                instance.glowSpriteB.y     = a2.y;
                instance.glowSpriteB.scale = Mathf.Lerp(20f, 38f, Mathf.Pow(num4, 0.75f));
                instance.glowSpriteB.alpha = Mathf.Pow(num4, 0.25f) * Mathf.Lerp(0.394f, 0.406f, UnityEngine.Random.value * (1f - Mathf.Lerp(instance.lastGlowAlpha, instance.glowAlpha, timeStacker)));
                instance.glowSpriteA.color = Color.Lerp(instance.effectColor, new Color(1f, 1f, 1f), 0.9f * num4);
                instance.glowSpriteA.x     = a2.x;
                instance.glowSpriteA.y     = a2.y;
                instance.glowSpriteA.scale = Mathf.Lerp(10f, 17f, Mathf.Pow(num4, 1.2f));
                instance.glowSpriteA.alpha = num4 * 0.6f;
            }
            for (int i = 0; i < instance.slugcatImage.depthIllustrations.Count; i++)
            {
                Vector2 a3 = instance.slugcatImage.depthIllustrations[i].pos;
                a3   -= new Vector2(0, artOffset);
                a3   -= instance.slugcatImage.CamPos(timeStacker) * 80f / instance.slugcatImage.depthIllustrations[i].depth;
                a3   += instance.sceneOffset;
                a3.x += num * instance.ScrollMagnitude;
                instance.slugcatImage.depthIllustrations[i].sprite.x     = a3.x;
                instance.slugcatImage.depthIllustrations[i].sprite.y     = a3.y;
                instance.slugcatImage.depthIllustrations[i].sprite.alpha = instance.slugcatImage.depthIllustrations[i].alpha * num2;
            }
            for (int j = 0; j < instance.slugcatImage.flatIllustrations.Count; j++)
            {
                Vector2 a4 = instance.slugcatImage.flatIllustrations[j].pos;
                a4   -= new Vector2(0, artOffset);
                a4   += instance.sceneOffset;
                a4.x += num * instance.ScrollMagnitude;
                instance.slugcatImage.flatIllustrations[j].sprite.x     = a4.x;
                instance.slugcatImage.flatIllustrations[j].sprite.y     = a4.y;
                instance.slugcatImage.flatIllustrations[j].sprite.alpha = instance.slugcatImage.flatIllustrations[j].alpha * num2;
            }

            if (instance.slugcatImage.depthIllustrations.Count > 0)
            {
                int lastIndex = instance.slugcatImage.depthIllustrations.Count - 1;

                if (customArtSprite != null)
                {
                    customArtSprite.RemoveFromContainer();
                    Vector2 a3 = new Vector2(Futile.screen.width / 2, Futile.screen.height / 2);
                    a3 += new Vector2(0, (Futile.screen.height * 2) - artOffset);
                    customArtSprite.x      = a3.x;
                    customArtSprite.y      = a3.y;
                    customArtSprite.width  = 400f;
                    customArtSprite.height = 400f;
                    customArtSprite.y     += customArtSprite.height / 6;
                    instance.slugcatImage.depthIllustrations[lastIndex].sprite.container.AddChild(customArtSprite);
                    customArtSprite.MoveToBack();
                    customArtSprite.MoveInFrontOfOtherNode(instance.slugcatImage.depthIllustrations[lastIndex].sprite);
                }
            }
        }
 public void KillHeart(FSprite heart)
 {
     Go.killAllTweensWithTarget(heart);
     hearts.Remove(heart);
     heart.RemoveFromContainer();
 }
Exemple #20
0
 public void Remove()
 {
     handle.RemoveFromContainer();
     name.RemoveFromContainer();
     nameShadow.RemoveFromContainer();
 }
Exemple #21
0
 public override void HandleRemovedFromContainer()
 {
     shadow.RemoveFromContainer();
     base.HandleRemovedFromContainer();
 }
Exemple #22
0
                public override void RemoveSprites()
                {
                    base.RemoveSprites();

                    arrow.RemoveFromContainer();
                }
 public void KillHeart(FSprite heart)
 {
     Go.killAllTweensWithTarget(heart);
     hearts.Remove(heart);
     heart.RemoveFromContainer();
 }
    public void EndGame()
    {
        FlyOutUIElements();

        scoreLabel.text = string.Format("{0:#,###0}", score);

        for (int i = hearts.Count - 1; i >= 0; i--)
        {
            FSprite heart = hearts[i];
            foreach (AbstractTween tween in Go.tweensWithTarget(heart))
            {
                Go.removeTween(tween);
            }
            heart.RemoveFromContainer();
            hearts.Remove(heart);
        }

        if (score >= 1000000)
        {
            StartHeartShower();
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("happyPiano");
            gameIsOver = true;
            FLabel label = new FLabel("SoftSugar", "I love you times a million!");
            label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            label.x     = Futile.screen.halfWidth;
            label.y     = Futile.screen.halfHeight;
            label.scale = 0;
            AddChild(label);

            TweenConfig config = new TweenConfig()
                                 .floatProp("scale", 1.0f)
                                 .setEaseType(EaseType.SineInOut)
                                 .onComplete(OnWinLabelDoneAppearing);

            Go.to(label, 0.5f, config);
        }

        if (numHeartsMissed >= 5)
        {
            gameIsOver = true;
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("sadPiano");
            FLabel topLabel    = new FLabel("SoftSugar", "Are you kidding me?!");
            FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score));
            topLabel.color    = new Color(0.75f, 0.12f, 0.12f, 1.0f);
            bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            bottomLabel.x     = topLabel.x = Futile.screen.halfWidth;
            float bottomBeginning = 300f;
            float segmentHeight   = (Futile.screen.height - bottomBeginning * 2f) / 3f;
            bottomLabel.y     = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning;
            topLabel.y        = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning;
            bottomLabel.scale = topLabel.scale = 0;
            AddChild(topLabel);
            AddChild(bottomLabel);

            TweenConfig config1 = new TweenConfig()
                                  .floatProp("scale", 1.0f)
                                  .setEaseType(EaseType.SineInOut);
            TweenConfig config2 = new TweenConfig()
                                  .floatProp("scale", 0.75f)
                                  .setEaseType(EaseType.SineInOut);

            float duration = 0.5f;

            TweenChain chain = new TweenChain();
            chain.append(new Tween(topLabel, duration, config1));
            chain.append(new Tween(bottomLabel, duration, config2));
            chain.setOnCompleteHandler(OnGameShouldBeFullyOver);

            Go.addTween(chain);
            chain.play();
        }
    }
Exemple #25
0
 public void HandlePlayerCollision(Player p)
 {
     if (p.isColliding(this))
     {
         //FSoundManager.PlaySound("powerup");
         isBeingPickedUp = true;
         FSoundManager.TweenVolume(.3f);
         p.isVisible = false;
         Go.killAllTweensWithTarget(p);
         p.State = Player.PlayerState.IDLE;
         p.xVel = 0;
         p.yVel = 0;
         Go.killAllTweensWithTarget(this);
         FSprite playerPickup = new FSprite("player_13");
         C.getCameraInstance().AddChild(playerPickup);
         Vector2 playerRelativePosition = p.GetPosition() + Futile.stage.GetPosition() - Vector2.up * 16f;
         playerPickup.SetPosition(playerRelativePosition);
         this.SetPosition(this.GetPosition() + Futile.stage.GetPosition() - Vector2.up * 16f);
         world.removeObject(this);
         C.getCameraInstance().AddChild(this);
         world.forceWaitLoad = true;
         RXDebug.Log(this.GetPosition(), playerPickup.GetPosition());
         this.MoveToFront();
         FLabel label = new FLabel(C.largeFontName, type.ToString().ToUpper() + " SPIRIT");
         C.getCameraInstance().AddChild(label);
         label.y = Futile.screen.halfHeight - label.textRect.height / 2f - 10;
         label.x = Futile.screen.halfWidth + label.textRect.width / 2f + 10;
         world.ShowLoading(() =>
         {
             Go.to(playerPickup, 2.0f, new TweenConfig().floatProp("x", 0).floatProp("y", -15).setEaseType(EaseType.QuadOut));
             Go.to(this, 2.0f, new TweenConfig().floatProp("x", 0).floatProp("y", 15).setEaseType(EaseType.QuadOut));
             Go.to(label, 1.5f, new TweenConfig().floatProp("x", 0).setEaseType(EaseType.BackOut).setDelay(1.5f).onComplete(() =>
             {
                 Go.to(this, .01f, new TweenConfig().floatProp("x", 1, true).onComplete(() =>
                 {
                     Go.to(this, .01f, new TweenConfig().floatProp("x", -2, true).setIterations(100, LoopType.PingPong).onComplete(() =>
                     {
                         FSoundManager.PlaySound("orbExplosion");
                         FSoundManager.PlaySound("powerup");
                         SpawnParticles(30);
                         this.x -= 1;
                         sprite.SetElementByName(type.ToString().ToLower() + "_soul");
                         Go.to(label, 1.5f, new TweenConfig().floatProp("x", -Futile.screen.halfWidth - label.textRect.width / 2f - 10).setEaseType(EaseType.BackIn).setDelay(2.0f).onStart((AbstractTween t) => { }).onComplete(() =>
                         {
                             label.RemoveFromContainer();
                             Go.to(playerPickup, 1.0f, new TweenConfig().floatProp("x", playerRelativePosition.x).floatProp("y", playerRelativePosition.y).setEaseType(EaseType.QuadInOut).onComplete(() =>
                             {
                                 FSoundManager.TweenVolume(1.0f);
                                 p.PickupSoul(this);
                                 world.HideLoading(() => { p.isVisible = true; playerPickup.RemoveFromContainer(); this.RemoveFromContainer(); });
                             }));
                             Vector2 powerupPos;
                             switch(type)
                             {
                                 case SoulType.JUMP:
                                     powerupPos = world.ui.slotAPos;
                                     break;
                                 default:
                                     powerupPos = world.ui.slotBPos;
                                     break;
                             }
                             Go.to(this, 1.0f, new TweenConfig().floatProp("x", powerupPos.x).floatProp("y", powerupPos.y).setEaseType(EaseType.QuadInOut));
                         }));
                     }));
                 }));
             }));
         });
     }
 }
Exemple #26
0
        public override void OnDeactivate()
        {
            _previewSprite.RemoveFromContainer();

            base.OnDeactivate();
        }