Example #1
0
 public static void BuffderLoadComplete()
 {
     BuffComponent.InitBuff(1);
     BuffComponent.InitBuff(2);
     BuffComponent.InitBuff(3);
     BuffComponent.InitBuff(4);
     BuffComponent.InitBuff(5);
 }
Example #2
0
        public void ApplyActiveBuffs(SmartEntity target, BuffModify modify, ref int modifyValue, int modifyValueMax)
        {
            BuffComponent buffComp = target.BuffComp;

            if (buffComp != null)
            {
                buffComp.ApplyActiveBuffs(modify, ref modifyValue, modifyValueMax);
            }
        }
Example #3
0
        private void RemoveBuffStack(SmartEntity target, BuffTypeVO buffType)
        {
            BuffComponent buffComp = target.BuffComp;

            if (buffComp == null)
            {
                return;
            }
            buffComp.RemoveBuffStack(buffType);
        }
Example #4
0
    public override MomentComponentBase DeepCopy()
    {
        BuffComponent bc = new BuffComponent();

        bc.buffList.Clear();

        for (int i = 0; i < buffList.Count; i++)
        {
            bc.buffList.Add(buffList[i].DeepCopy());
        }

        return(bc);
    }
Example #5
0
        private void AddEntityToRecheckVisualAfterLoadList(SmartEntity entity, Buff buff)
        {
            BuildingComponent buildingComp = entity.BuildingComp;
            TroopComponent    troopComp    = entity.TroopComp;
            BuffComponent     buffComp     = entity.BuffComp;

            if (buildingComp != null)
            {
                buffComp.RegisterForVisualReAddOnBuilding(buff);
            }
            else if (troopComp != null)
            {
                buffComp.RegisterForVisualReAddOnTroop(buff);
            }
        }
Example #6
0
    public void Update(BuffComponent buffComponent)
    {
        if (buffComponent == null || buffComponent.enable == false)
        {
            return;
        }

        foreach (Buff buff in buffComponent.buffs)
        {
            if (!buff.finish)
            {
                buff.Update();
            }
        }
    }
Example #7
0
        private void TryAddBuffStack(SmartEntity target, BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority, SmartEntity originator)
        {
            if (target == null || buffType == null || !buffType.WillAffect(armorType))
            {
                return;
            }
            BuffComponent buffComponent = target.BuffComp;

            if (buffComponent == null)
            {
                buffComponent = new BuffComponent();
                target.Add(buffComponent);
            }
            else if (buffComponent.IsBuffPrevented(buffType))
            {
                return;
            }
            buffComponent.AddBuffStack(buffType, armorType, visualPriority, originator);
            buffComponent.RemoveBuffsCanceledBy(buffType);
        }
Example #8
0
        private void RemoveBuffShaders(uint id, object cookie)
        {
            NodeList <BuildingNode> nodeList = Service.Get <EntityController>().GetNodeList <BuildingNode>();

            for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next)
            {
                SmartEntity   smartEntity = (SmartEntity)buildingNode.Entity;
                BuffComponent buffComp    = smartEntity.BuffComp;
                if (buffComp != null && buffComp.Buffs.Count != 0)
                {
                    this.RestoreShadersAfterBuff(smartEntity);
                    if (this.shaderSwappedBuffs.ContainsKey(smartEntity))
                    {
                        this.shaderSwappedBuffs.Remove(smartEntity);
                    }
                }
            }
            this.oldMaterials.Clear();
            this.shaderSwappedMaterials.Clear();
            this.shaderSwappedBuffs.Clear();
        }
 protected override void OnReset()
 {
     base.OnReset();
     ComponentMgr.Instance.ReleaseComponent <BuffComponent>(_buffComp);
     _buffComp = null;
 }
 protected override void OnInit()
 {
     base.OnInit();
     _buffComp = ComponentMgr.Instance.CreateComponent <BuffComponent>(this, EntityObject, null);
 }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory   = new AggregateFactory(this);
            WeaponFactory      = new WeaponFactory(this);
            DoorFactory        = new DoorFactory(this);
            RoomFactory        = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory        = new WallFactory(this);
            EnemyFactory       = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory         = new NPCFactory(this);

            // Initialize Components
            PlayerComponent          = new PlayerComponent();
            LocalComponent           = new LocalComponent();
            RemoteComponent          = new RemoteComponent();
            PositionComponent        = new PositionComponent();
            MovementComponent        = new MovementComponent();
            MovementSpriteComponent  = new MovementSpriteComponent();
            SpriteComponent          = new SpriteComponent();
            DoorComponent            = new DoorComponent();
            RoomComponent            = new RoomComponent();
            HUDSpriteComponent       = new HUDSpriteComponent();
            HUDComponent             = new HUDComponent();
            InventoryComponent       = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen    = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent       = new EquipmentComponent();
            WeaponComponent          = new WeaponComponent();
            BulletComponent          = new BulletComponent();
            PlayerInfoComponent      = new PlayerInfoComponent();
            WeaponSpriteComponent    = new WeaponSpriteComponent();
            StatsComponent           = new StatsComponent();
            EnemyAIComponent         = new EnemyAIComponent();
            NpcAIComponent           = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent   = new CollisionComponent();
            TriggerComponent     = new TriggerComponent();
            EnemyComponent       = new EnemyComponent();
            NPCComponent         = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager             = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent        = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent           = new SoundComponent();
            ActorTextComponent       = new ActorTextComponent();
            TurretComponent          = new TurretComponent();
            TrapComponent            = new TrapComponent();
            ExplodingDroidComponent  = new ExplodingDroidComponent();
            HealingStationComponent  = new HealingStationComponent();
            PortableShieldComponent  = new PortableShieldComponent();
            PortableStoreComponent   = new PortableStoreComponent();
            ActiveSkillComponent     = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();
            MatchingPuzzleComponent  = new MatchingPuzzleComponent();
            pI = new PlayerInfo();

            Quests = new List <Quest>();


            #region Initialize Effect Components
            AgroDropComponent          = new AgroDropComponent();
            AgroGainComponent          = new AgroGainComponent();
            BuffComponent              = new BuffComponent();
            ChanceToSucceedComponent   = new ChanceToSucceedComponent();
            ChangeVisibilityComponent  = new ChangeVisibilityComponent();
            CoolDownComponent          = new CoolDownComponent();
            DamageOverTimeComponent    = new DamageOverTimeComponent();
            DirectDamageComponent      = new DirectDamageComponent();
            DirectHealComponent        = new DirectHealComponent();
            FearComponent              = new FearComponent();
            HealOverTimeComponent      = new HealOverTimeComponent();
            PsiOrFatigueRegenComponent = new PsiOrFatigueRegenComponent();
            InstantEffectComponent     = new InstantEffectComponent();
            KnockBackComponent         = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent   = new ReduceAgroRangeComponent();
            ResurrectComponent         = new ResurrectComponent();
            StunComponent              = new StunComponent();
            TimedEffectComponent       = new TimedEffectComponent();
            EnslaveComponent           = new EnslaveComponent();
            CloakComponent             = new CloakComponent();
            #endregion

            base.Initialize();
        }
Example #13
0
 public override object Remove(Type compCls)
 {
     if (compCls == typeof(AreaTriggerComponent))
     {
         this.AreaTriggerComp = null;
     }
     else if (compCls == typeof(ArmoryComponent))
     {
         this.ArmoryComp = null;
     }
     else if (compCls == typeof(AssetComponent))
     {
         this.AssetComp = null;
     }
     else if (compCls == typeof(AttackerComponent))
     {
         this.AttackerComp = null;
     }
     else if (compCls == typeof(BarracksComponent))
     {
         this.BarracksComp = null;
     }
     else if (compCls == typeof(BoardItemComponent))
     {
         this.BoardItemComp = null;
     }
     else if (compCls == typeof(BuildingAnimationComponent))
     {
         this.BuildingAnimationComp = null;
     }
     else if (compCls == typeof(BuildingComponent))
     {
         this.BuildingComp = null;
     }
     else if (compCls == typeof(CantinaComponent))
     {
         this.CantinaComp = null;
     }
     else if (compCls == typeof(ChampionComponent))
     {
         this.ChampionComp = null;
     }
     else if (compCls == typeof(CivilianComponent))
     {
         this.CivilianComp = null;
     }
     else if (compCls == typeof(ClearableComponent))
     {
         this.ClearableComp = null;
     }
     else if (compCls == typeof(DamageableComponent))
     {
         this.DamageableComp = null;
     }
     else if (compCls == typeof(DefenderComponent))
     {
         this.DefenderComp = null;
     }
     else if (compCls == typeof(DefenseLabComponent))
     {
         this.DefenseLabComp = null;
     }
     else if (compCls == typeof(DroidComponent))
     {
         this.DroidComp = null;
     }
     else if (compCls == typeof(DroidHutComponent))
     {
         this.DroidHutComp = null;
     }
     else if (compCls == typeof(SquadBuildingComponent))
     {
         this.SquadBuildingComp = null;
     }
     else if (compCls == typeof(NavigationCenterComponent))
     {
         this.NavigationCenterComp = null;
     }
     else if (compCls == typeof(FactoryComponent))
     {
         this.FactoryComp = null;
     }
     else if (compCls == typeof(FleetCommandComponent))
     {
         this.FleetCommandComp = null;
     }
     else if (compCls == typeof(FollowerComponent))
     {
         this.FollowerComp = null;
     }
     else if (compCls == typeof(GameObjectViewComponent))
     {
         this.GameObjectViewComp = null;
     }
     else if (compCls == typeof(GeneratorComponent))
     {
         this.GeneratorComp = null;
     }
     else if (compCls == typeof(GeneratorViewComponent))
     {
         this.GeneratorViewComp = null;
     }
     else if (compCls == typeof(HealerComponent))
     {
         this.HealerComp = null;
     }
     else if (compCls == typeof(HealthComponent))
     {
         this.HealthComp = null;
     }
     else if (compCls == typeof(TroopShieldComponent))
     {
         this.TroopShieldComp = null;
     }
     else if (compCls == typeof(TroopShieldViewComponent))
     {
         this.TroopShieldViewComp = null;
     }
     else if (compCls == typeof(TroopShieldHealthComponent))
     {
         this.TroopShieldHealthComp = null;
     }
     else if (compCls == typeof(HealthViewComponent))
     {
         this.HealthViewComp = null;
     }
     else if (compCls == typeof(HQComponent))
     {
         this.HQComp = null;
     }
     else if (compCls == typeof(KillerComponent))
     {
         this.KillerComp = null;
     }
     else if (compCls == typeof(LootComponent))
     {
         this.LootComp = null;
     }
     else if (compCls == typeof(MeterShaderComponent))
     {
         this.MeterShaderComp = null;
     }
     else if (compCls == typeof(OffenseLabComponent))
     {
         this.OffenseLabComp = null;
     }
     else if (compCls == typeof(PathingComponent))
     {
         this.PathingComp = null;
     }
     else if (compCls == typeof(SecondaryTargetsComponent))
     {
         this.SecondaryTargetsComp = null;
     }
     else if (compCls == typeof(ShieldBorderComponent))
     {
         this.ShieldBorderComp = null;
     }
     else if (compCls == typeof(ShieldGeneratorComponent))
     {
         this.ShieldGeneratorComp = null;
     }
     else if (compCls == typeof(SizeComponent))
     {
         this.SizeComp = null;
     }
     else if (compCls == typeof(ShooterComponent))
     {
         this.ShooterComp = null;
     }
     else if (compCls == typeof(StarportComponent))
     {
         this.StarportComp = null;
     }
     else if (compCls == typeof(StateComponent))
     {
         this.StateComp = null;
     }
     else if (compCls == typeof(StorageComponent))
     {
         this.StorageComp = null;
     }
     else if (compCls == typeof(SupportComponent))
     {
         this.SupportComp = null;
     }
     else if (compCls == typeof(SupportViewComponent))
     {
         this.SupportViewComp = null;
     }
     else if (compCls == typeof(TacticalCommandComponent))
     {
         this.TacticalCommandComp = null;
     }
     else if (compCls == typeof(ChampionPlatformComponent))
     {
         this.ChampionPlatformComp = null;
     }
     else if (compCls == typeof(TeamComponent))
     {
         this.TeamComp = null;
     }
     else if (compCls == typeof(TrackingComponent))
     {
         this.TrackingComp = null;
     }
     else if (compCls == typeof(TrackingGameObjectViewComponent))
     {
         this.TrackingGameObjectViewComp = null;
     }
     else if (compCls == typeof(TransformComponent))
     {
         this.TransformComp = null;
     }
     else if (compCls == typeof(TransportComponent))
     {
         this.TransportComp = null;
     }
     else if (compCls == typeof(TroopComponent))
     {
         this.TroopComp = null;
     }
     else if (compCls == typeof(TurretBuildingComponent))
     {
         this.TurretBuildingComp = null;
     }
     else if (compCls == typeof(TurretShooterComponent))
     {
         this.TurretShooterComp = null;
     }
     else if (compCls == typeof(WalkerComponent))
     {
         this.WalkerComp = null;
     }
     else if (compCls == typeof(WallComponent))
     {
         this.WallComp = null;
     }
     else if (compCls == typeof(BuffComponent))
     {
         this.BuffComp = null;
     }
     else if (compCls == typeof(TrapComponent))
     {
         this.TrapComp = null;
     }
     else if (compCls == typeof(TrapViewComponent))
     {
         this.TrapViewComp = null;
     }
     else if (compCls == typeof(HousingComponent))
     {
         this.HousingComp = null;
     }
     else if (compCls == typeof(SpawnComponent))
     {
         this.SpawnComp = null;
     }
     return(base.Remove(compCls));
 }
Example #14
0
        protected override Entity AddComponentAndDispatchAddEvent(ComponentBase comp, Type compCls)
        {
            bool flag = false;

            if (comp is AreaTriggerComponent)
            {
                this.AreaTriggerComp = (AreaTriggerComponent)comp;
                flag = true;
            }
            if (comp is ArmoryComponent)
            {
                this.ArmoryComp = (ArmoryComponent)comp;
                flag            = true;
            }
            if (comp is AssetComponent)
            {
                this.AssetComp = (AssetComponent)comp;
                flag           = true;
            }
            if (comp is AttackerComponent)
            {
                this.AttackerComp = (AttackerComponent)comp;
                flag = true;
            }
            if (comp is BarracksComponent)
            {
                this.BarracksComp = (BarracksComponent)comp;
                flag = true;
            }
            if (comp is BoardItemComponent)
            {
                this.BoardItemComp = (BoardItemComponent)comp;
                flag = true;
            }
            if (comp is BuildingAnimationComponent)
            {
                this.BuildingAnimationComp = (BuildingAnimationComponent)comp;
                flag = true;
            }
            if (comp is BuildingComponent)
            {
                this.BuildingComp = (BuildingComponent)comp;
                flag = true;
            }
            if (comp is ChampionComponent)
            {
                this.ChampionComp = (ChampionComponent)comp;
                flag = true;
            }
            if (comp is CivilianComponent)
            {
                this.CivilianComp = (CivilianComponent)comp;
                flag = true;
            }
            if (comp is ClearableComponent)
            {
                this.ClearableComp = (ClearableComponent)comp;
                flag = true;
            }
            if (comp is DamageableComponent)
            {
                this.DamageableComp = (DamageableComponent)comp;
                flag = true;
            }
            if (comp is DefenderComponent)
            {
                this.DefenderComp = (DefenderComponent)comp;
                flag = true;
            }
            if (comp is DefenseLabComponent)
            {
                this.DefenseLabComp = (DefenseLabComponent)comp;
                flag = true;
            }
            if (comp is DroidComponent)
            {
                this.DroidComp = (DroidComponent)comp;
                flag           = true;
            }
            if (comp is DroidHutComponent)
            {
                this.DroidHutComp = (DroidHutComponent)comp;
                flag = true;
            }
            if (comp is SquadBuildingComponent)
            {
                this.SquadBuildingComp = (SquadBuildingComponent)comp;
                flag = true;
            }
            if (comp is NavigationCenterComponent)
            {
                this.NavigationCenterComp = (NavigationCenterComponent)comp;
                flag = true;
            }
            if (comp is FactoryComponent)
            {
                this.FactoryComp = (FactoryComponent)comp;
                flag             = true;
            }
            if (comp is CantinaComponent)
            {
                this.CantinaComp = (CantinaComponent)comp;
                flag             = true;
            }
            if (comp is FleetCommandComponent)
            {
                this.FleetCommandComp = (FleetCommandComponent)comp;
                flag = true;
            }
            if (comp is FollowerComponent)
            {
                this.FollowerComp = (FollowerComponent)comp;
                flag = true;
            }
            if (comp is GameObjectViewComponent)
            {
                this.GameObjectViewComp = (GameObjectViewComponent)comp;
                flag = true;
            }
            if (comp is GeneratorComponent)
            {
                this.GeneratorComp = (GeneratorComponent)comp;
                flag = true;
            }
            if (comp is GeneratorViewComponent)
            {
                this.GeneratorViewComp = (GeneratorViewComponent)comp;
                flag = true;
            }
            if (comp is HealerComponent)
            {
                this.HealerComp = (HealerComponent)comp;
                flag            = true;
            }
            if (comp is TroopShieldComponent)
            {
                this.TroopShieldComp = (TroopShieldComponent)comp;
                flag = true;
            }
            if (comp is TroopShieldViewComponent)
            {
                this.TroopShieldViewComp = (TroopShieldViewComponent)comp;
                flag = true;
            }
            if (comp is TroopShieldHealthComponent)
            {
                this.TroopShieldHealthComp = (TroopShieldHealthComponent)comp;
                flag = true;
            }
            if (comp is HealthComponent)
            {
                this.HealthComp = (HealthComponent)comp;
                flag            = true;
            }
            if (comp is HealthViewComponent)
            {
                this.HealthViewComp = (HealthViewComponent)comp;
                flag = true;
            }
            if (comp is HQComponent)
            {
                this.HQComp = (HQComponent)comp;
                flag        = true;
            }
            if (comp is KillerComponent)
            {
                this.KillerComp = (KillerComponent)comp;
                flag            = true;
            }
            if (comp is LootComponent)
            {
                this.LootComp = (LootComponent)comp;
                flag          = true;
            }
            if (comp is MeterShaderComponent)
            {
                this.MeterShaderComp = (MeterShaderComponent)comp;
                flag = true;
            }
            if (comp is OffenseLabComponent)
            {
                this.OffenseLabComp = (OffenseLabComponent)comp;
                flag = true;
            }
            if (comp is PathingComponent)
            {
                this.PathingComp = (PathingComponent)comp;
                flag             = true;
            }
            if (comp is SecondaryTargetsComponent)
            {
                this.SecondaryTargetsComp = (SecondaryTargetsComponent)comp;
                flag = true;
            }
            if (comp is ShieldBorderComponent)
            {
                this.ShieldBorderComp = (ShieldBorderComponent)comp;
                flag = true;
            }
            if (comp is ShieldGeneratorComponent)
            {
                this.ShieldGeneratorComp = (ShieldGeneratorComponent)comp;
                flag = true;
            }
            if (comp is SizeComponent)
            {
                this.SizeComp = (SizeComponent)comp;
                flag          = true;
            }
            if (comp is ShooterComponent)
            {
                this.ShooterComp = (ShooterComponent)comp;
                flag             = true;
            }
            if (comp is StarportComponent)
            {
                this.StarportComp = (StarportComponent)comp;
                flag = true;
            }
            if (comp is StateComponent)
            {
                this.StateComp = (StateComponent)comp;
                flag           = true;
            }
            if (comp is StorageComponent)
            {
                this.StorageComp = (StorageComponent)comp;
                flag             = true;
            }
            if (comp is SupportComponent)
            {
                this.SupportComp = (SupportComponent)comp;
                flag             = true;
            }
            if (comp is SupportViewComponent)
            {
                this.SupportViewComp = (SupportViewComponent)comp;
                flag = true;
            }
            if (comp is TacticalCommandComponent)
            {
                this.TacticalCommandComp = (TacticalCommandComponent)comp;
                flag = true;
            }
            if (comp is ChampionPlatformComponent)
            {
                this.ChampionPlatformComp = (ChampionPlatformComponent)comp;
                flag = true;
            }
            if (comp is TeamComponent)
            {
                this.TeamComp = (TeamComponent)comp;
                flag          = true;
            }
            if (comp is TrackingComponent)
            {
                this.TrackingComp = (TrackingComponent)comp;
                flag = true;
            }
            if (comp is TrackingGameObjectViewComponent)
            {
                this.TrackingGameObjectViewComp = (TrackingGameObjectViewComponent)comp;
                flag = true;
            }
            if (comp is TransformComponent)
            {
                this.TransformComp = (TransformComponent)comp;
                flag = true;
            }
            if (comp is TransportComponent)
            {
                this.TransportComp = (TransportComponent)comp;
                flag = true;
            }
            if (comp is TroopComponent)
            {
                this.TroopComp = (TroopComponent)comp;
                flag           = true;
            }
            if (comp is TurretBuildingComponent)
            {
                this.TurretBuildingComp = (TurretBuildingComponent)comp;
                flag = true;
            }
            if (comp is TurretShooterComponent)
            {
                this.TurretShooterComp = (TurretShooterComponent)comp;
                flag = true;
            }
            if (comp is WalkerComponent)
            {
                this.WalkerComp = (WalkerComponent)comp;
                flag            = true;
            }
            if (comp is WallComponent)
            {
                this.WallComp = (WallComponent)comp;
                flag          = true;
            }
            if (comp is BuffComponent)
            {
                this.BuffComp = (BuffComponent)comp;
                flag          = true;
            }
            if (comp is TrapComponent)
            {
                this.TrapComp = (TrapComponent)comp;
                flag          = true;
            }
            if (comp is TrapViewComponent)
            {
                this.TrapViewComp = (TrapViewComponent)comp;
                flag = true;
            }
            if (comp is HousingComponent)
            {
                this.HousingComp = (HousingComponent)comp;
                flag             = true;
            }
            if (comp is ScoutTowerComponent)
            {
                this.ScoutTowerComp = (ScoutTowerComponent)comp;
                flag = true;
            }
            if (comp is SpawnComponent)
            {
                this.SpawnComp = (SpawnComponent)comp;
                flag           = true;
            }
            if (!flag && compCls != null)
            {
                Service.Logger.Error("Invalid component add: " + compCls.Name);
            }
            return(base.AddComponentAndDispatchAddEvent(comp, compCls));
        }
Example #15
0
        public void Execute()
        {
            long time = (long)(m_Contexts.input.time.Value * 1000);

            foreach (GameEntity entity in m_ImpactEntities)
            {
                BuffComponent buffComponent = entity.buff;
                foreach (var pair in buffComponent.InstanceInfos)
                {
                    int buffId = pair.Key;
                    var infos  = pair.Value;
                    for (int i = infos.Count - 1; i >= 0; i--)
                    {
                        var info = infos[i];
                        info.BuffInstance.Tick(time);
                        if (info.BuffInstance.IsTerminated)
                        {
                            RecycleImpactInstance(info);

                            entity.isBuffAttrChanged = true;

                            infos.Remove(info);
                        }
                    }
                }
                foreach (var startParam in buffComponent.StartParams)
                {
                    //SkillSystem.Instance.BreakSkill(entity);

                    BuffConfig buffConfig = BuffConfigProvider.Instance.GetBuffConfig(startParam.Id);
                    if (null != buffConfig)
                    {
                        int maxCount = buffConfig.MaxCount;

                        if (!buffComponent.InstanceInfos.TryGetValue(startParam.Id, out List <BuffInstanceInfo> infos))
                        {
                            infos = new List <BuffInstanceInfo>();
                            buffComponent.InstanceInfos.Add(startParam.Id, infos);
                        }
                        if (maxCount == 0 && infos.Count > 0)
                        {
                            continue;
                        }
                        else if (maxCount > 0 && infos.Count >= maxCount)
                        {
                            for (int i = 0; i < infos.Count - maxCount + 1; ++i)
                            {
                                if (!infos[i].BuffInstance.IsTerminated)
                                {
                                    infos[i].BuffInstance.SendMessage("onbreak");
                                    infos[i].BuffInstance.IsTerminated = true;
                                }
                            }
                        }

                        BuffInstanceInfo instance = NewBuffInstance(startParam.Id);
                        if (null != instance)
                        {
                            instance.BuffInstance.SenderId        = startParam.SenderId;
                            instance.BuffInstance.SenderPosition  = startParam.SenderPosition;
                            instance.BuffInstance.SenderDirection = startParam.SenderDirection;
                            instance.BuffInstance.Target          = entity;
                            instance.BuffInstance.Context         = Contexts.sharedInstance.game;
                            instance.BuffInstance.AddVariable("@@id", entity.id.value);
                            instance.BuffInstance.GlobalVariables = m_GlobalVariables;
                            instance.BuffInstance.Start();

                            infos.Add(instance);

                            entity.isBuffAttrChanged = true;
                        }
                    }
                }
                buffComponent.StartParams.Clear();
            }
        }