Пример #1
0
        public void ExecuteTrap(TrapComponent comp, int boardX, int boardZ)
        {
            TrapEventType eventType = comp.Type.EventType;

            if (eventType != TrapEventType.SpecialAttack)
            {
                if (eventType != TrapEventType.Turret)
                {
                    return;
                }
                this.SwapTrapToTurret((SmartEntity)comp.Entity);
                this.SetTrapState(comp, TrapState.Active);
            }
            else
            {
                Vector3 zero = Vector3.zero;
                zero.x = Units.BoardToWorldX(boardX);
                zero.z = Units.BoardToWorldX(boardZ);
                SpecialAttackTypeVO specialAttackTypeVO = Service.Get <IDataController>().Get <SpecialAttackTypeVO>(comp.Type.ShipTED.SpecialAttackName);
                Service.Get <SpecialAttackController>().DeploySpecialAttack(specialAttackTypeVO, TeamType.Defender, zero);
                if (comp.Type.DisarmConditions == "EventSuccess")
                {
                    this.SetTrapState(comp, TrapState.Active);
                    this.SetTrapState(comp, TrapState.Spent);
                }
                if (!specialAttackTypeVO.IsDropship)
                {
                    Service.Get <ViewTimerManager>().CreateViewTimer((specialAttackTypeVO.AnimationDelay + specialAttackTypeVO.HitDelay) * 0.001f, false, new TimerDelegate(this.OnStarshipStrike), comp.Entity);
                    return;
                }
            }
        }
Пример #2
0
    private void AddChest(Vector3 location, bool locked, bool trapped, bool addHealth)
    {
        int id = Game.EntityManager.CreateEntity();

        var formComp = new FormComponent();

        formComp.InitComponent(id, location, "Chest001", "Chest001_Broken");
        Game.EntityManager.AddComponent(id, formComp);

        var openComp = new OpenComponent();

        openComp.InitComponent(null);
        Game.EntityManager.AddComponent(id, openComp);

        var animComp = new AnimationComponent();

        animComp.InitComponent(null);
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "ChestClose", Sound = "ChestClose001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Close
        });
        animComp.Animations.Add(new AnimationSystem.AnimationData()
        {
            EntityID = id, Name = "ChestOpen90", Sound = "ChestOpen001", DisablePhysics = true, TriggerEvent = RPGGameEvent.Menu_Open
        });
        Game.EntityManager.AddComponent(id, animComp);

        if (locked)
        {
            var lockComp = new LockComponent();
            lockComp.InitComponent(null);
            lockComp.InitComponent(44);
            Game.EntityManager.AddComponent(id, lockComp);
        }

        if (trapped)
        {
            var trapComp = new TrapComponent();
            trapComp.InitComponent(formComp, new EffectSystem.EffectData()
            {
                AreaOfEffectRadius = 10,
                Duration           = 5,
                PrefabName         = "AOE/Fireball",
                TargetType         = EffectSystem.TargetTypeEnum.AreaOfEffect,
                Damage             = new DieRollData(2, 4, 0, 0),
                DamageType         = AttackSystem.DamageTypes.Crush,
                Description_Attack = "Fireball Blast"
            });
            Game.EntityManager.AddComponent(id, trapComp);
        }

        if (addHealth)
        {
            var health = new HealthComponent()
            {
                Damage = 0, DeathType = HealthComponent.DeathTypes.Broken, HP_Max = 5000
            };
            Game.EntityManager.AddComponent(id, health);
        }
    }
Пример #3
0
        public void SetTrapState(TrapComponent comp, TrapState state)
        {
            SmartEntity       smartEntity  = (SmartEntity)comp.Entity;
            TrapViewComponent trapViewComp = smartEntity.TrapViewComp;
            TrapState         currentState = comp.CurrentState;

            if (currentState != state)
            {
                comp.CurrentState = state;
                IState currentState2 = Service.Get <GameStateMachine>().CurrentState;
                if (TrapUtils.IsCurrentPlayerInDefensiveBattle(currentState2))
                {
                    smartEntity.BuildingComp.BuildingTO.CurrentStorage = ((state == TrapState.Armed) ? 1 : 0);
                }
                Service.Get <TrapViewController>().UpdateTrapVisibility((SmartEntity)comp.Entity);
                switch (state)
                {
                case TrapState.Spent:
                    Service.Get <EventManager>().SendEvent(EventId.TrapDisarmed, comp);
                    break;

                case TrapState.Active:
                    Service.Get <EventManager>().SendEvent(EventId.TrapTriggered, comp);
                    break;

                case TrapState.Destroyed:
                    comp.CurrentState = TrapState.Spent;
                    Service.Get <EventManager>().SendEvent(EventId.TrapDestroyed, comp);
                    break;
                }
            }
            Service.Get <TrapViewController>().SetTrapViewState(trapViewComp, state);
        }
        private void UpdateAnimation(Entity entity, IState gameMode, BuildingAnimationComponent animComp, bool updateContraband)
        {
            TrapComponent trapComp = ((SmartEntity)entity).TrapComp;

            if (trapComp != null)
            {
                return;
            }
            if (this.BuildingEligibleForActiveAnimation(entity, gameMode, animComp))
            {
                this.PlayAnimation(animComp.Anim, "Active");
                this.PlayFXs(animComp.ListOfParticleSystems);
            }
            else if (this.BuildingEligibleForIdleAnimation(entity, gameMode, animComp))
            {
                this.PlayAnimation(animComp.Anim, "Idle");
                this.StopFXs(animComp.ListOfParticleSystems);
            }
            else
            {
                this.StopAnimation(animComp.Anim);
                this.StopFXs(animComp.ListOfParticleSystems);
            }
            this.UpdateArmoryAnimation((SmartEntity)entity);
            if (updateContraband)
            {
                this.UpdateContraBandShipAnimation((SmartEntity)entity);
            }
        }
Пример #5
0
        private bool LoadAddOns(EntityViewParams viewParams)
        {
            TrapComponent trapComp = viewParams.Entity.TrapComp;

            if (trapComp == null)
            {
                return(false);
            }
            if (trapComp.Type.AddOns == null || trapComp.Type.AddOns.Count == 0)
            {
                return(false);
            }
            AssetManager  assetManager = Service.AssetManager;
            List <string> list         = new List <string>();
            List <object> list2        = new List <object>();
            int           i            = 0;
            int           count        = trapComp.Type.AddOns.Count;

            while (i < count)
            {
                AssetHandle item = AssetHandle.Invalid;
                viewParams.Entity.AssetComp.AddOnsAssetHandles.Add(item);
                AddOnMapping    addOnMapping = trapComp.Type.AddOns[i];
                string          model        = addOnMapping.Model;
                AddOnViewParams item2        = new AddOnViewParams(viewParams.Entity, addOnMapping.Parent);
                list.Add(model);
                list2.Add(item2);
                assetManager.RegisterPreloadableAsset(model);
                i++;
            }
            assetManager.MultiLoad(viewParams.Entity.AssetComp.AddOnsAssetHandles, list, new AssetSuccessDelegate(this.AddOnSuccess), null, list2, new AssetsCompleteDelegate(this.OnAllAddonsLoaded), viewParams);
            return(true);
        }
Пример #6
0
        public void AddTrapComponentsToEntity(Entity buildingEntity, BuildingTypeVO buildingType)
        {
            TrapTypeVO    type           = Service.Get <IDataController>().Get <TrapTypeVO>(buildingType.TrapUid);
            TrapState     currentStorage = (TrapState)buildingEntity.Get <BuildingComponent>().BuildingTO.CurrentStorage;
            TrapComponent component      = new TrapComponent(type, currentStorage);

            buildingEntity.Add(component);
        }
Пример #7
0
    private void ConfigureTrap(TrapComponent trap, FormComponent formParent)
    {
        // Configure FormComponent
        var trapGO = formParent.AddChild(PrefabName_TrapDetectionRange);

        if (trapGO != null)
        {
            formParent.SetSphereColliderRadius(trapGO, trap.DetectionRange);
        }

        // Configure more stuff here...
    }
Пример #8
0
        public TrapCombatTrigger(TrapNode node)
        {
            this.controller        = Service.Get <TrapController>();
            this.comp              = node.TrapComp;
            this.transform         = node.TransformComp;
            this.health            = node.HealthComp;
            this.Owner             = node.Entity;
            this.Type              = CombatTriggerType.Area;
            this.AreaRadius        = 0u;
            this.triggerConditions = node.TrapComp.Type.ParsedTrapConditions;
            int i     = 0;
            int count = this.triggerConditions.Count;

            while (i < count)
            {
                if (this.triggerConditions[i] is RadiusTrapCondition)
                {
                    this.Type       = CombatTriggerType.Area;
                    this.AreaRadius = ((RadiusTrapCondition)this.triggerConditions[i]).Radius;
                }
                i++;
            }
        }
Пример #9
0
        public void SetTrapState(TrapComponent comp, TrapState state)
        {
            SmartEntity       smartEntity  = (SmartEntity)comp.Entity;
            TrapViewComponent trapViewComp = smartEntity.TrapViewComp;
            TrapState         currentState = comp.CurrentState;

            if (currentState != state)
            {
                comp.CurrentState = state;
                IState currentState2 = Service.GameStateMachine.CurrentState;
                if (TrapUtils.IsCurrentPlayerInDefensiveBattle(currentState2))
                {
                    smartEntity.BuildingComp.BuildingTO.CurrentStorage = ((state != TrapState.Armed) ? 0 : 1);
                }
                Service.TrapViewController.UpdateTrapVisibility((SmartEntity)comp.Entity);
                if (state != TrapState.Active)
                {
                    if (state != TrapState.Spent)
                    {
                        if (state == TrapState.Destroyed)
                        {
                            comp.CurrentState = TrapState.Spent;
                            Service.EventManager.SendEvent(EventId.TrapDestroyed, comp);
                        }
                    }
                    else
                    {
                        Service.EventManager.SendEvent(EventId.TrapDisarmed, comp);
                    }
                }
                else
                {
                    Service.EventManager.SendEvent(EventId.TrapTriggered, comp);
                }
            }
            Service.TrapViewController.SetTrapViewState(trapViewComp, state);
        }
Пример #10
0
        private void PrepareEntityView(SmartEntity entity, GameObject gameObject)
        {
            EntityRef entityRef = gameObject.AddComponent <EntityRef>();

            entityRef.Entity = entity;
            IDataController         dataController = Service.Get <IDataController>();
            GameObjectViewComponent gameObjectViewComponent;

            if (entity.GameObjectViewComp != null)
            {
                gameObjectViewComponent = entity.GameObjectViewComp;
                UnityEngine.Object.Destroy(gameObjectViewComponent.MainGameObject);
                gameObjectViewComponent.MainGameObject = gameObject;
            }
            else
            {
                float tooltipHeightOffset = 0f;
                if (entity.BuildingComp != null)
                {
                    tooltipHeightOffset = entity.BuildingComp.BuildingType.TooltipHeightOffset;
                    EffectsTypeVO effectsTypeVO = dataController.Get <EffectsTypeVO>("effect203");
                    AssetManager  assetManager  = Service.Get <AssetManager>();
                    assetManager.RegisterPreloadableAsset(effectsTypeVO.AssetName);
                    AssetHandle assetHandle = AssetHandle.Invalid;
                    assetManager.Load(ref assetHandle, effectsTypeVO.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity);
                }
                else if (entity.TroopComp != null)
                {
                    TroopTypeVO troopTypeVO = Service.Get <IDataController>().Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid);
                    tooltipHeightOffset = troopTypeVO.TooltipHeightOffset;
                }
                gameObjectViewComponent = new GameObjectViewComponent(gameObject, tooltipHeightOffset);
                entity.Add(gameObjectViewComponent);
            }
            SupportComponent     supportComp     = entity.SupportComp;
            SupportViewComponent supportViewComp = entity.SupportViewComp;

            if (supportComp != null && supportViewComp == null)
            {
                SupportViewComponent component = new SupportViewComponent();
                entity.Add <SupportViewComponent>(component);
                if (Service.Get <BuildingController>().PurchasingBuilding != entity)
                {
                    Service.Get <BuildingTooltipController>().EnsureBuildingTooltip(entity);
                }
            }
            GeneratorComponent     generatorComp          = entity.GeneratorComp;
            GeneratorViewComponent generatorViewComponent = entity.GeneratorViewComp;

            if (generatorComp != null && generatorViewComponent == null)
            {
                generatorViewComponent = new GeneratorViewComponent(entity);
                entity.Add <GeneratorViewComponent>(generatorViewComponent);
            }
            TrapComponent     trapComp          = entity.TrapComp;
            TrapViewComponent trapViewComponent = entity.TrapViewComp;

            if (trapComp != null && trapViewComponent == null)
            {
                Animator  component2 = gameObjectViewComponent.MainGameObject.GetComponent <Animator>();
                Transform transform  = gameObjectViewComponent.MainGameObject.transform.FindChild("Contents");
                if (component2 == null)
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a MecAnim controller. Building Uid: {0}, AssetName: {1}", new object[]
                    {
                        entity.BuildingComp.BuildingType.Uid,
                        entity.BuildingComp.BuildingType.AssetName
                    });
                }
                else if (transform == null)
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a Contents transform. Building Uid: {0}, AssetName: {1}", new object[]
                    {
                        entity.BuildingComp.BuildingType.Uid,
                        entity.BuildingComp.BuildingType.AssetName
                    });
                }
                else
                {
                    GameObject gameObject2 = transform.gameObject;
                    if (gameObject2 == null)
                    {
                        Service.Get <StaRTSLogger>().ErrorFormat("A trap has been added that does not have a Contents GameObject. Building Uid: {0}, AssetName: {1}", new object[]
                        {
                            entity.BuildingComp.BuildingType.Uid,
                            entity.BuildingComp.BuildingType.AssetName
                        });
                    }
                    trapViewComponent = new TrapViewComponent(component2);
                    if (trapComp.Type.EventType == TrapEventType.Turret)
                    {
                        Transform transform2 = gameObjectViewComponent.MainGameObject.transform;
                        Transform transform3 = transform2.FindChild(trapComp.Type.TurretTED.TurretAnimatorName);
                        if (transform3 == null)
                        {
                            Service.Get <StaRTSLogger>().ErrorFormat("Trap {0}: Cannot find a gameobject in path {1}", new object[]
                            {
                                entity.BuildingComp.BuildingType.Uid,
                                trapComp.Type.TurretTED.TurretAnimatorName
                            });
                        }
                        else
                        {
                            Animator component3 = transform3.gameObject.GetComponent <Animator>();
                            if (component3 == null)
                            {
                                Service.Get <StaRTSLogger>().ErrorFormat("Trap {0}: Cannot find an animator on gameobject in path {1}", new object[]
                                {
                                    entity.BuildingComp.BuildingType.Uid,
                                    trapComp.Type.TurretTED.TurretAnimatorName
                                });
                            }
                            else
                            {
                                trapViewComponent.TurretAnim = component3;
                            }
                        }
                    }
                    entity.Add <TrapViewComponent>(trapViewComponent);
                }
            }
            AssetMeshDataMonoBehaviour component4 = gameObjectViewComponent.MainGameObject.GetComponent <AssetMeshDataMonoBehaviour>();

            if (component4 != null && component4.OtherGameObjects != null)
            {
                for (int i = 0; i < component4.OtherGameObjects.Count; i++)
                {
                    if (component4.OtherGameObjects[i].name.Contains("center_of_mass"))
                    {
                        gameObjectViewComponent.CenterOfMass = component4.OtherGameObjects[i];
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_hit"))
                    {
                        gameObjectViewComponent.HitLocators.Add(component4.OtherGameObjects[i]);
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_vehicle"))
                    {
                        gameObjectViewComponent.VehicleLocator = component4.OtherGameObjects[i];
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_effect"))
                    {
                        gameObjectViewComponent.EffectLocators.Add(component4.OtherGameObjects[i]);
                    }
                }
            }
            FactoryComponent factoryComp = entity.FactoryComp;

            if (factoryComp != null)
            {
                EffectsTypeVO effectsTypeVO2 = dataController.Get <EffectsTypeVO>("effect203");
                AssetManager  assetManager2  = Service.Get <AssetManager>();
                assetManager2.RegisterPreloadableAsset(effectsTypeVO2.AssetName);
                AssetHandle assetHandle2 = AssetHandle.Invalid;
                assetManager2.Load(ref assetHandle2, effectsTypeVO2.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity);
            }
            this.SetupGunLocators(entity, component4);
            if (entity.TroopShieldHealthComp != null && entity.TroopShieldViewComp == null)
            {
                TroopTypeVO troop = Service.Get <IDataController>().Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid);
                entity.Add <TroopShieldViewComponent>(new TroopShieldViewComponent(troop));
            }
            gameObject.SetActive(false);
            this.CheckHealthView(entity);
            this.CheckMeterShaderView(entity);
            Service.Get <EntityRenderController>().UpdateNewEntityView(entity);
        }
Пример #11
0
        private void PrepareEntityView(SmartEntity entity, GameObject gameObject)
        {
            EntityRef entityRef = gameObject.AddComponent <EntityRef>();

            entityRef.Entity = entity;
            StaticDataController    staticDataController = Service.StaticDataController;
            GameObjectViewComponent gameObjectViewComponent;

            if (entity.GameObjectViewComp != null)
            {
                gameObjectViewComponent = entity.GameObjectViewComp;
                Vector3 position = gameObjectViewComponent.MainTransform.position;
                UnityEngine.Object.Destroy(gameObjectViewComponent.MainGameObject);
                gameObjectViewComponent.MainGameObject         = gameObject;
                gameObjectViewComponent.MainTransform.position = position;
            }
            else
            {
                float tooltipHeightOffset = 0f;
                if (entity.BuildingComp != null)
                {
                    tooltipHeightOffset = entity.BuildingComp.BuildingType.TooltipHeightOffset;
                    EffectsTypeVO effectsTypeVO = staticDataController.Get <EffectsTypeVO>("effect203");
                    AssetManager  assetManager  = Service.AssetManager;
                    assetManager.RegisterPreloadableAsset(effectsTypeVO.AssetName);
                    AssetHandle assetHandle = AssetHandle.Invalid;
                    assetManager.Load(ref assetHandle, effectsTypeVO.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity);
                }
                else if (entity.TroopComp != null)
                {
                    TroopTypeVO troopTypeVO = Service.StaticDataController.Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid);
                    tooltipHeightOffset = troopTypeVO.TooltipHeightOffset;
                }
                gameObjectViewComponent = new GameObjectViewComponent(gameObject, tooltipHeightOffset);
                entity.Add(gameObjectViewComponent);
            }
            SupportComponent     supportComp     = entity.SupportComp;
            SupportViewComponent supportViewComp = entity.SupportViewComp;

            if (supportComp != null && supportViewComp == null)
            {
                SupportViewComponent component = new SupportViewComponent();
                entity.Add <SupportViewComponent>(component);
                if (Service.BuildingController.PurchasingBuilding != entity)
                {
                    Service.BuildingTooltipController.EnsureBuildingTooltip(entity);
                }
            }
            GeneratorComponent     generatorComp          = entity.GeneratorComp;
            GeneratorViewComponent generatorViewComponent = entity.GeneratorViewComp;

            if (generatorComp != null && generatorViewComponent == null)
            {
                generatorViewComponent = new GeneratorViewComponent(entity);
                entity.Add <GeneratorViewComponent>(generatorViewComponent);
            }
            TrapComponent     trapComp          = entity.TrapComp;
            TrapViewComponent trapViewComponent = entity.TrapViewComp;

            if (trapComp != null && trapViewComponent == null)
            {
                Animator  component2 = gameObjectViewComponent.MainGameObject.GetComponent <Animator>();
                Transform transform  = gameObjectViewComponent.MainGameObject.transform.Find("Contents");
                if (component2 == null)
                {
                    Service.Logger.ErrorFormat("A trap has been added that does not have a MecAnim controller. Building Uid: {0}, AssetName: {1}", new object[]
                    {
                        entity.BuildingComp.BuildingType.Uid,
                        entity.BuildingComp.BuildingType.AssetName
                    });
                }
                else if (transform == null)
                {
                    Service.Logger.ErrorFormat("A trap has been added that does not have a Contents transform. Building Uid: {0}, AssetName: {1}", new object[]
                    {
                        entity.BuildingComp.BuildingType.Uid,
                        entity.BuildingComp.BuildingType.AssetName
                    });
                }
                else
                {
                    GameObject gameObject2 = transform.gameObject;
                    if (gameObject2 == null)
                    {
                        Service.Logger.ErrorFormat("A trap has been added that does not have a Contents GameObject. Building Uid: {0}, AssetName: {1}", new object[]
                        {
                            entity.BuildingComp.BuildingType.Uid,
                            entity.BuildingComp.BuildingType.AssetName
                        });
                    }
                    trapViewComponent = new TrapViewComponent(component2);
                    if (trapComp.Type.EventType == TrapEventType.Turret)
                    {
                        Transform transform2 = gameObjectViewComponent.MainGameObject.transform;
                        Transform transform3 = transform2.Find(trapComp.Type.TurretTED.TurretAnimatorName);
                        if (transform3 == null)
                        {
                            Service.Logger.ErrorFormat("Trap {0}: Cannot find a gameobject in path {1}", new object[]
                            {
                                entity.BuildingComp.BuildingType.Uid,
                                trapComp.Type.TurretTED.TurretAnimatorName
                            });
                        }
                        else
                        {
                            Animator component3 = transform3.gameObject.GetComponent <Animator>();
                            if (component3 == null)
                            {
                                Service.Logger.ErrorFormat("Trap {0}: Cannot find an animator on gameobject in path {1}", new object[]
                                {
                                    entity.BuildingComp.BuildingType.Uid,
                                    trapComp.Type.TurretTED.TurretAnimatorName
                                });
                            }
                            else
                            {
                                trapViewComponent.TurretAnim = component3;
                            }
                        }
                    }
                    entity.Add <TrapViewComponent>(trapViewComponent);
                }
            }
            AssetMeshDataMonoBehaviour component4 = gameObjectViewComponent.MainGameObject.GetComponent <AssetMeshDataMonoBehaviour>();

            if (component4 != null && component4.OtherGameObjects != null)
            {
                for (int i = 0; i < component4.OtherGameObjects.Count; i++)
                {
                    if (component4.OtherGameObjects[i].name.Contains("center_of_mass"))
                    {
                        gameObjectViewComponent.CenterOfMass = component4.OtherGameObjects[i];
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_hit"))
                    {
                        gameObjectViewComponent.HitLocators.Add(component4.OtherGameObjects[i]);
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_vehicle"))
                    {
                        gameObjectViewComponent.VehicleLocator = component4.OtherGameObjects[i];
                    }
                    else if (component4.OtherGameObjects[i].name.Contains("locator_effect"))
                    {
                        gameObjectViewComponent.EffectLocators.Add(component4.OtherGameObjects[i]);
                    }
                }
            }
            if (entity.TroopComp != null)
            {
                TroopTypeVO troopTypeVO2 = (TroopTypeVO)entity.TroopComp.TroopType;
                if (!string.IsNullOrEmpty(troopTypeVO2.PlanetAttachmentId))
                {
                    string uid = Service.WorldTransitioner.GetMapDataLoader().GetPlanetData().Uid;
                    List <PlanetAttachmentVO> list = new List <PlanetAttachmentVO>();
                    foreach (PlanetAttachmentVO current in staticDataController.GetAll <PlanetAttachmentVO>())
                    {
                        if (current.AttachmentId == troopTypeVO2.PlanetAttachmentId && current.Planets != null && Array.IndexOf <string>(current.Planets, uid) != -1)
                        {
                            list.Add(current);
                        }
                    }
                    AssetManager assetManager2 = Service.AssetManager;
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] == null)
                        {
                            Service.Logger.ErrorFormat("Attachment is null for troop {0}, asset {1}", new object[]
                            {
                                troopTypeVO2.Uid,
                                troopTypeVO2.AssetName
                            });
                        }
                        else
                        {
                            AssetHandle        assetHandle2       = AssetHandle.Invalid;
                            PlanetAttachmentTO planetAttachmentTO = new PlanetAttachmentTO();
                            planetAttachmentTO.Entity  = entity;
                            planetAttachmentTO.Locator = UnityUtils.FindGameObject(gameObjectViewComponent.MainGameObject, list[j].Locator);
                            if (planetAttachmentTO.Locator == null)
                            {
                                Service.Logger.ErrorFormat("Locator {0} not found in asset {1}, and it should be according to PlanetAttachmentData {2}", new object[]
                                {
                                    list[j].Locator,
                                    troopTypeVO2.AssetName,
                                    list[j].Uid
                                });
                                planetAttachmentTO.Locator = gameObjectViewComponent.MainGameObject;
                            }
                            assetManager2.Load(ref assetHandle2, list[j].AssetName, new AssetSuccessDelegate(this.PlanetAttachmentSuccess), null, planetAttachmentTO);
                        }
                    }
                }
            }
            FactoryComponent factoryComp = entity.FactoryComp;

            if (factoryComp != null)
            {
                EffectsTypeVO effectsTypeVO2 = staticDataController.Get <EffectsTypeVO>("effect203");
                AssetManager  assetManager3  = Service.AssetManager;
                assetManager3.RegisterPreloadableAsset(effectsTypeVO2.AssetName);
                AssetHandle assetHandle3 = AssetHandle.Invalid;
                assetManager3.Load(ref assetHandle3, effectsTypeVO2.AssetName, new AssetSuccessDelegate(this.SparkFxSuccess), null, entity);
            }
            this.SetupGunLocators(entity, component4);
            if (entity.TroopShieldHealthComp != null && entity.TroopShieldViewComp == null)
            {
                TroopTypeVO troop = Service.StaticDataController.Get <TroopTypeVO>(entity.TroopComp.TroopType.Uid);
                entity.Add <TroopShieldViewComponent>(new TroopShieldViewComponent(troop));
            }
            gameObject.SetActive(false);
            this.CheckHealthView(entity);
            this.CheckMeterShaderView(entity);
            Service.EntityRenderController.UpdateNewEntityView(entity);
        }
Пример #12
0
        /// <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();
        }
Пример #14
0
    private static bool DisarmTrapResult(SkillComponent skill, TrapComponent trap)
    {
        bool success = skill.TrapDisarmLevel >= trap.DisarmLevel;

        return(success);
    }
Пример #15
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));
 }
Пример #16
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));
        }
Пример #17
0
 private static void RemoveTrap(int itemID, TrapComponent trap)
 {
     trap.FormParent.DestroyChild("Trap");
     GameBehavior.thisGame.EntityManager.RemoveComponent(itemID, typeof(TrapComponent));
 }
Пример #18
0
    private bool DetectTrapResult(SkillComponent skill, TrapComponent trap)
    {
        bool detected = skill.TrapDetectionLevel >= trap.DetectionLevel;

        return(detected);
    }