Пример #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
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id != EventId.EntityKilled)
     {
         if (id == EventId.BattleEndProcessing)
         {
             NodeList <TrapNode> nodeList = Service.Get <EntityController>().GetNodeList <TrapNode>();
             for (TrapNode trapNode = nodeList.Head; trapNode != null; trapNode = trapNode.Next)
             {
                 if (trapNode.TrapComp.CurrentState == TrapState.Active && trapNode.TrapComp.Type.EventType == TrapEventType.Turret)
                 {
                     this.SwapTurretToTrap((SmartEntity)trapNode.Entity);
                 }
             }
         }
     }
     else
     {
         SmartEntity smartEntity = cookie as SmartEntity;
         if (smartEntity.TrapComp != null)
         {
             TrapTypeVO type = smartEntity.TrapComp.Type;
             this.SetTrapState(smartEntity.TrapComp, TrapState.Spent);
             TrapEventType eventType = type.EventType;
             if (eventType == TrapEventType.Turret)
             {
                 this.SwapTurretToTrap(smartEntity);
             }
         }
     }
     return(EatResponse.NotEaten);
 }
Пример #3
0
 public static ITrapEventData ParseEventData(TrapEventType type, string rawData)
 {
     if (type == TrapEventType.SpecialAttack)
     {
         return(new SpecialAttackTrapEventData().Init(rawData));
     }
     if (type != TrapEventType.Turret)
     {
         return(null);
     }
     return(new TurretTrapEventData().Init(rawData));
 }
Пример #4
0
 public void ReadRow(Row row)
 {
     this.Uid       = row.Uid;
     this.EventType = StringUtils.ParseEnum <TrapEventType>(row.TryGetString(TrapTypeVO.COLUMN_eventType));
     this.SetEventData(TrapUtils.ParseEventData(this.EventType, row.TryGetString(TrapTypeVO.COLUMN_eventData)));
     this.TargetType           = row.TryGetString(TrapTypeVO.COLUMN_targetType);
     this.TriggerConditions    = row.TryGetString(TrapTypeVO.COLUMN_triggerConditions);
     this.RevealAudio          = row.TryGetString(TrapTypeVO.COLUMN_revealAudio);
     this.DisarmConditions     = row.TryGetString(TrapTypeVO.COLUMN_disarmConditions);
     this.AddOns               = TrapUtils.ParseAddons(row.TryGetString(TrapTypeVO.COLUMN_addOns));
     this.RearmCreditsCost     = row.TryGetInt(TrapTypeVO.COLUMN_rearmCreditsCost);
     this.RearmMaterialsCost   = row.TryGetInt(TrapTypeVO.COLUMN_rearmMaterialsCost);
     this.RearmContrabandCost  = row.TryGetInt(TrapTypeVO.COLUMN_rearmContrabandCost);
     this.ParsedTrapConditions = TrapUtils.ParseConditions(this.TriggerConditions);
 }
Пример #5
0
        public int GetTrapDamageForUIDisplay(TrapTypeVO trapType)
        {
            TrapEventType eventType = trapType.EventType;

            if (eventType == TrapEventType.SpecialAttack)
            {
                SpecialAttackTypeVO specialAttackTypeVO = Service.Get <IDataController>().Get <SpecialAttackTypeVO>(trapType.ShipTED.SpecialAttackName);
                return(specialAttackTypeVO.DPS);
            }
            if (eventType != TrapEventType.Turret)
            {
                return(0);
            }
            TurretTypeVO turretTypeVO = Service.Get <IDataController>().Get <TurretTypeVO>(trapType.TurretTED.TurretUid);

            return(turretTypeVO.DPS);
        }
Пример #6
0
        public static uint GetTrapAttackRadius(TrapTypeVO trapType)
        {
            IDataController dataController = Service.Get <IDataController>();
            TrapEventType   eventType      = trapType.EventType;

            if (eventType == TrapEventType.SpecialAttack)
            {
                string specialAttackName = trapType.ShipTED.SpecialAttackName;
                SpecialAttackTypeVO specialAttackTypeVO = dataController.Get <SpecialAttackTypeVO>(specialAttackName);
                ProjectileTypeVO    projectileType      = specialAttackTypeVO.ProjectileType;
                return((uint)projectileType.SplashRadius);
            }
            if (eventType == TrapEventType.Turret)
            {
                string       turretUid    = trapType.TurretTED.TurretUid;
                TurretTypeVO turretTypeVO = dataController.Get <TurretTypeVO>(turretUid);
                return(turretTypeVO.MaxAttackRange);
            }
            return(0u);
        }