Esempio n. 1
0
        public void DestroyArmoryShuttle(SmartEntity entity)
        {
            if (!this.shuttles.ContainsKey(entity))
            {
                return;
            }
            ShuttleAnim shuttleAnim = this.shuttles[entity];

            if (shuttleAnim.State == ShuttleState.Idle || !ArmoryUtils.IsAnyEquipmentActive(Service.CurrentPlayer.ActiveArmory))
            {
                this.RemoveStarportShuttle(entity);
            }
        }
        private bool BuildingEligibleForIdleAnimation(Entity entity, IState gameState, BuildingAnimationComponent animComp)
        {
            if (entity == null)
            {
                return(false);
            }
            if (gameState is EditBaseState)
            {
                return(false);
            }
            if (animComp.BuildingUpgrading)
            {
                return(false);
            }
            if (Service.Get <PostBattleRepairController>().IsEntityInRepair(entity))
            {
                return(false);
            }
            BuildingComponent buildingComponent = entity.Get <BuildingComponent>();

            if (buildingComponent == null)
            {
                return(false);
            }
            if (!(gameState is HomeState))
            {
                return(false);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.ScoutTower)
            {
                return(true);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.Armory)
            {
                ActiveArmory activeArmory = Service.Get <CurrentPlayer>().ActiveArmory;
                return(!ArmoryUtils.IsAnyEquipmentActive(activeArmory));
            }
            return(false);
        }
        private bool BuildingEligibleForActiveAnimation(Entity entity, IState gameState, BuildingAnimationComponent animComp)
        {
            if (entity == null)
            {
                return(false);
            }
            if (gameState is EditBaseState)
            {
                return(false);
            }
            if (animComp.BuildingUpgrading)
            {
                return(false);
            }
            if (Service.Get <PostBattleRepairController>().IsEntityInRepair(entity))
            {
                return(false);
            }
            if (animComp.Manufacturing)
            {
                return(true);
            }
            BuildingComponent buildingComponent = entity.Get <BuildingComponent>();

            if (buildingComponent == null)
            {
                return(false);
            }
            BuildingTypeVO buildingType = buildingComponent.BuildingType;

            if (buildingType.Type == BuildingType.HQ)
            {
                return(true);
            }
            if (buildingType.Type == BuildingType.ShieldGenerator && buildingType.SubType == BuildingSubType.OutpostDefenseGenerator)
            {
                return(true);
            }
            if (!(gameState is HomeState))
            {
                return(false);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.Barracks || buildingComponent.BuildingType.Type == BuildingType.Cantina)
            {
                return(true);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.DroidHut)
            {
                return(true);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.ScoutTower)
            {
                return(Service.Get <RaidDefenseController>().IsRaidAvailable());
            }
            if (buildingComponent.BuildingType.Type == BuildingType.Resource && buildingComponent.BuildingTO.AccruedCurrency < buildingType.Storage)
            {
                return(true);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.Storage && buildingComponent.BuildingTO.CurrentStorage < buildingType.Storage)
            {
                return(true);
            }
            if (buildingComponent.BuildingType.Type == BuildingType.Armory)
            {
                ActiveArmory activeArmory = Service.Get <CurrentPlayer>().ActiveArmory;
                return(ArmoryUtils.IsAnyEquipmentActive(activeArmory));
            }
            return(false);
        }