Esempio n. 1
0
    private void RenderState()
    {
        switch (this.state)
        {
        case ObstructionState.Falling: {
            var fallDown = this.gameObject.GetComponent <ObstructionFallDown>();

            if (this.areaMapper != null)
            {
                fallDown.startingPosition = this.areaMapper.gameObject.transform.position;
            }

            if (this.currentLifeTime + 0.2 >= this.totalLifeTime)
            {
                this.state = ObstructionState.Exploding;
            }

            break;
        }

        case ObstructionState.Exploding: {
            this.explosionParticle = Instantiate(this.explosionParticle) as ExplodeParticle;
            this.explosionParticle.transform.position = (transform.Find(this.mineName)).position;

            this.state = ObstructionState.Dying;

            break;
        }

        case ObstructionState.Dying: {
            if (this.areaMapper != null)
            {
                this.areaMapper.hasObstruction = false;
            }
            foreach (Transform child in transform)
            {
                child.GetComponent <MeshRenderer>().enabled = false;
            }

            this.state = ObstructionState.Dead;

            break;
        }

        case ObstructionState.Dead: {
            Destroy(gameObject);
            break;
        }

        default:  {
            break;
        }
        }
    }
Esempio n. 2
0
        public void ExplodeMatchedGroups()
        {
            Color color = HexagonManager.Instance.GetHexagon(_matchedGroups[0].A).GetColor();

            for (int i = 0; i < _matchedGroups.Count; i++)
            {
                ExplodeParticle explodeParticle = PoolManager.Instance.GetNewExplodeParticle();
                if (explodeParticle)
                {
                    explodeParticle.SetColor(color);
                    explodeParticle.SetPosition(HexagonManager.Instance.PixelToWorld(_matchedGroups[i].GetCenter()));
                    explodeParticle.Explode();
                }

                HexagonManager.Instance.ExplodeHexagon(_matchedGroups[i].A);
                HexagonManager.Instance.ExplodeHexagon(_matchedGroups[i].B);
                HexagonManager.Instance.ExplodeHexagon(_matchedGroups[i].C);
            }
        }
Esempio n. 3
0
 public void DespawnExplodeParticle(ExplodeParticle explodeParticle)
 {
     explodeParticlePool.Despawn(explodeParticle.gameObject);
 }
Esempio n. 4
0
        public override void Kill(Player attackPlayer)
        {
            Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) / 2f + Main.screenPosition;

            Main.PlaySound(SoundID.Item, (int)screenCenter.X, (int)screenCenter.Y + -30, 14, 1f, 0f);
            Position.X  = CardGameUI.ToUIPos(Position).X + (float)(Size.X / 2);
            Position.Y  = CardGameUI.ToUIPos(Position).Y + (float)(Size.Y / 2);
            Size.X      = 20;
            Size.Y      = 20;
            Position.X -= (float)(Size.X / 2);
            Position.Y -= (float)(Size.Y / 2);
            for (int i = 0; i < 23; i++)
            {
                FireParticle particle = new FireParticle()
                {
                    Position        = new Vector2(Position.X, Position.Y),
                    UIPosition      = UIPosition,
                    Alpha           = 100,
                    IsPanelParticle = true
                };
                particle.Setup(Size, 1f, attackPlayer);
                if (Main.rand.Next(2) == 0)
                {
                    particle.Scale = 0.5f;
                }
                particle.Velocity *= 2f;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            for (int j = 0; j < 20; j++)
            {
                FireParticle2 particle = new FireParticle2()
                {
                    Position        = new Vector2(Position.X, Position.Y),
                    UIPosition      = UIPosition,
                    Alpha           = 100,
                    IsPanelParticle = true
                };
                particle.Setup(Size, 1f, attackPlayer);
                particle.Velocity *= 2f;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            for (int k = 0; k < Main.rand.Next(5, 7); k++)
            {
                float scaleFactor = 0.33f;
                if (k % 3 == 1)
                {
                    scaleFactor = 0.66f;
                }
                if (k % 3 == 1)
                {
                    scaleFactor = 1f;
                }
                ExplodeParticle particle = new ExplodeParticle()
                {
                    Position        = new Vector2(Position.X + (float)(Size.X / 2) - 24f, Position.Y + (float)(Size.Y / 2) - 24f),
                    UIPosition      = UIPosition,
                    Alpha           = Main.rand.Next(140, 201),
                    IsPanelParticle = true
                };
                particle.Setup(Size, Main.rand.NextFloat() * 0.5f + 1f, attackPlayer);
                particle.Velocity *= scaleFactor;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);

                particle = new ExplodeParticle()
                {
                    Position        = new Vector2(Position.X + (float)(Size.X / 2) - 24f, Position.Y + (float)(Size.Y / 2) - 24f),
                    UIPosition      = UIPosition,
                    Alpha           = Main.rand.Next(140, 201),
                    IsPanelParticle = true
                };
                particle.Setup(Size, Main.rand.NextFloat() * 0.5f + 1f, attackPlayer);
                particle.Velocity *= scaleFactor;
                attackPlayer.GetModPlayer <EntrogicPlayer>()._particles.Add(particle);
            }
            //for (float rad = 0.0f; rad < 2 * 3.141f; rad += (float)Main.rand.Next(8, 14) / 10)
            //{
            //    Vector2 vec = new Vector2(120f, 0f);
            //    Vector2 finalVec = (vec.ToRotation() + rad).ToRotationVector2() * 16f;
            //    Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-10, 11), Main.rand.Next(-10, 11), ProjectileType<PineapplePieces>(), 21, 0f, projectile.owner, 0f, 0f);
            //}
            base.Kill(attackPlayer);
        }