Ejemplo n.º 1
0
        public void Kill(IBonusEffect bEffect)
        {
            //if (BonusEffects.Count != 0) return;
            var finded = BonusEffects.FindAll((b) => {
                var bb = b.BonusType == bEffect.BonusType;
                return(bb);
            });

            if (finded.Count == 0)
            {
                BonusEffects.Add(bEffect);

                if (bEffect.BonusType == BonusEffect.LINE_H || bEffect.BonusType == BonusEffect.LINE_V)
                {
                    ((LineBonusEffect)bEffect).BeforeLastStep += (effect) =>
                    {
                        switch (effect.Direction)
                        {
                        case LineBonusEffectDirection.LR:
                            KillRightLine();
                            break;

                        case LineBonusEffectDirection.RL:
                            KillLeftLine();
                            break;

                        case LineBonusEffectDirection.TB:
                            KillBottomLine();
                            break;

                        case LineBonusEffectDirection.BT:
                            KillTopLine();
                            break;
                        }
                    };
                }

                Kill();
            }
        }
Ejemplo n.º 2
0
        public void Update(int dt)
        {
            if (Moving == PositionAnimationState.NONE && AnimationState == SpriteAnimationState.NONE && BonusEffects.Count == 0)
            {
                return;
            }

            if (Moving == PositionAnimationState.MOVE)
            {
                UpdatePosition(dt);
                return;
            }

            if (BonusEffects.Count != 0)
            {
                int countEnd = 0;

                for (int i = 0; i < BonusEffects.Count; i++)
                {
                    BonusEffects[i].Update(dt);
                    if (BonusEffects[i].State == DynamicState.END)
                    {
                        switch (BonusEffects[i].BonusType)
                        {
                        case BonusEffect.WAIT_BANG:
                            BangNear();
                            break;
                        }
                    }
                    countEnd += BonusEffects[i].State == DynamicState.END || BonusEffects[i].State == DynamicState.STOP ? 1 : 0;
                }

                /*foreach(var b in BonusEffects)
                 * {
                 *  b.Update(dt);
                 *  if(b.State == DynamicState.END)
                 *  {
                 *      switch (b.BonusType)
                 *      {
                 *          case BonusEffect.WAIT_BANG:
                 *              BangNear();
                 *              break;
                 *      }
                 *  }
                 *  countEnd += b.State == DynamicState.END || b.State == DynamicState.STOP ? 1 : 0;
                 * }*/

                if (countEnd == BonusEffects.Count)
                {
                    BonusEffects.Clear();
                }
            }


            ddt += dt;

            if (ddt >= gc.ADTime)
            {
                ddt = 0;
                if (AnimationState == SpriteAnimationState.SELECT)
                {
                    SpriteAnimationStep += selectedDirection;
                    if (SpriteAnimationStep <= 0 || SpriteAnimationStep == 5)
                    {
                        selectedDirection *= -1;
                    }
                    if (SpriteAnimationStep < 0)
                    {
                        SpriteAnimationStep = 1;
                    }
                    return;
                }
                else if (AnimationState == SpriteAnimationState.SHOW)
                {
                    SpriteAnimationStep--;
                    if (SpriteAnimationStep <= 0)
                    {
                        SpriteAnimationStep = 0;
                        AnimationState      = SpriteAnimationState.NONE;
                    }
                    return;
                }
                else if (AnimationState == SpriteAnimationState.HIDE)
                {
                    SpriteAnimationStep++;
                    if (SpriteAnimationStep >= 9)
                    {
                        SpriteAnimationStep = 9;
                        AnimationState      = SpriteAnimationState.NONE;
                        Visible             = false;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 protected void SetBonusEffect(IBonusEffect effect)
 {
     BonusEffects.Add(effect);
 }
Ejemplo n.º 4
0
 void Awake()
 {
     instance = this;
 }