예제 #1
0
        protected override bool SetupParticlesOnShow(Entity entity)
        {
            BuildingTypeVO buildingType = entity.Get <BuildingComponent>().BuildingType;

            if (buildingType.Type == BuildingType.Trap && entity.Get <TrapComponent>().CurrentState != TrapState.Spent && !ContractUtils.IsBuildingUpgrading(entity) && !ContractUtils.IsBuildingConstructing(entity))
            {
                TrapTypeVO trapType         = Service.Get <IDataController>().Get <TrapTypeVO>(buildingType.TrapUid);
                uint       trapMaxRadius    = TrapUtils.GetTrapMaxRadius(trapType);
                uint       trapAttackRadius = TrapUtils.GetTrapAttackRadius(trapType);
                base.SetupParticleSystemWithRange(this.triggerRadius, 5f, trapMaxRadius);
                base.SetupParticleSystemWithRange(this.damageRadius, 5f, trapAttackRadius);
                return(true);
            }
            return(false);
        }
예제 #2
0
        private void UpdateRadius()
        {
            int           trapMaxRadius  = (int)TrapUtils.GetTrapMaxRadius(this.trapVO);
            int           trapMaxRadius2 = (int)TrapUtils.GetTrapMaxRadius(this.maxTrapVO);
            SliderControl sliderControl  = this.sliders[1];

            sliderControl.DescLabel.Text      = this.lang.Get("TRAP_TRIGGER_RADIUS", new object[0]);
            sliderControl.CurrentLabel.Text   = this.lang.ThousandsSeparated(trapMaxRadius);
            sliderControl.CurrentSlider.Value = ((trapMaxRadius2 == 0) ? 0f : ((float)trapMaxRadius / (float)trapMaxRadius2));
            if (this.useUpgradeGroup && this.nextTrapVO != null)
            {
                int trapMaxRadius3 = (int)TrapUtils.GetTrapMaxRadius(this.maxTrapVO);
                sliderControl.NextLabel.Text = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(trapMaxRadius3 - trapMaxRadius)
                });
                sliderControl.NextSlider.Value = ((trapMaxRadius2 == 0) ? 0f : ((float)trapMaxRadius3 / (float)trapMaxRadius2));
            }
        }
예제 #3
0
        private void DetermineTriggerRange(SmartEntity entity, ref uint triggerRange)
        {
            if (entity.BuildingComp == null)
            {
                return;
            }
            BuildingTypeVO buildingType = entity.BuildingComp.BuildingType;

            if (buildingType.Type == BuildingType.Squad || buildingType.Type == BuildingType.ChampionPlatform)
            {
                triggerRange = buildingType.ActivationRadius;
                return;
            }
            if (entity.ShooterComp != null)
            {
                triggerRange = entity.ShooterComp.ShooterVO.MaxAttackRange;
                return;
            }
            if (entity.TrapComp != null)
            {
                triggerRange = TrapUtils.GetTrapMaxRadius(entity.TrapComp.Type);
                return;
            }
        }