예제 #1
0
 public StripeFilterEffect(StripeEffectComponent component)
     : base(ItemType.StripeFilter)
 {
     this.component   = component;
     component.Effect = this;
     EffectLevel      = 1;
 }
예제 #2
0
파일: MainGame.cs 프로젝트: KHCmaster/PPD
        private void AddEffect(ItemType itemType, int userID)
        {
            ItemEffect itemEffect = null;

            if (itemManagerComponent.ContainEffect(ItemType.Barrier))
            {
                // Reflect to person
                client.Write(MessagePackSerializer.Serialize(new AddEffectToPlayerNetworkData {
                    UserId = userID, ItemType = itemType
                }));
            }
            else if (itemManagerComponent.ContainEffect(ItemType.Stealth))
            {
                // Nothing to do
            }
            else
            {
                switch (itemType)
                {
                case ItemType.DoubleBPM:
                    if (itemManagerComponent.ContainEffect(ItemType.DoubleBPM))
                    {
                        var effect = itemManagerComponent.GetEffect(ItemType.DoubleBPM);
                        effect.AddEffect();
                    }
                    else
                    {
                        itemEffect = new DoubleBPMEffect();
                    }
                    break;

                case ItemType.FogFilter:
                    if (itemManagerComponent.ContainEffect(ItemType.FogFilter))
                    {
                        var effect = itemManagerComponent.GetEffect(ItemType.FogFilter);
                        effect.AddEffect();
                    }
                    else
                    {
                        var fogComponent = new FogEffectComponent(device, ResourceManager);
                        itemEffect = new FogFilterEffect(fogComponent);
                        filterSprite.AddChild(fogComponent);
                    }
                    break;

                case ItemType.HalfScore:
                    itemEffect = new HalfScoreEffect();
                    break;

                case ItemType.Hidden:
                    itemEffect = new HiddenEffect();
                    break;

                case ItemType.StripeFilter:
                    if (itemManagerComponent.ContainEffect(ItemType.StripeFilter))
                    {
                        var effect = itemManagerComponent.GetEffect(ItemType.StripeFilter);
                        effect.AddEffect();
                    }
                    else
                    {
                        var stripeComponent = new StripeEffectComponent(device, ResourceManager);
                        itemEffect = new StripeFilterEffect(stripeComponent);
                        filterSprite.AddChild(stripeComponent);
                    }
                    break;

                case ItemType.Sudden:
                    itemEffect = new SuddenEffect();
                    break;

                case ItemType.PingPong:
                    if (itemManagerComponent.ContainEffect(ItemType.PingPong))
                    {
                        var effect = itemManagerComponent.GetEffect(ItemType.PingPong);
                        effect.AddEffect();
                    }
                    else
                    {
                        var pingPongComponent = new PingPongEffectComponent(device, ResourceManager);
                        itemEffect = new PingPongEffect(pingPongComponent);
                        filterSprite.AddChild(pingPongComponent);
                    }
                    break;

                case ItemType.Stealth:
                    itemEffect = new StealthEffect();
                    var userPlayState = FindUserPlayState(userID);
                    if (userPlayState != null)
                    {
                        userPlayState.IsStealth = true;
                    }
                    itemEffect.Removed += (sender, e) =>
                    {
                        userPlayState.IsStealth = false;
                    };
                    itemManagerComponent.AddOthersEffect(itemEffect);
                    itemEffect = null;
                    break;
                }
            }

            if (itemEffect != null)
            {
                itemManagerComponent.AddEffect(itemEffect);
            }

            if (expansionClient != null)
            {
                expansionClient.Send(new ItemInfo
                {
                    CurrentTime = mainGameComponent.MoviePosition,
                    ItemType    = itemType,
                    PlayerId    = userID
                });
            }
        }