Пример #1
0
        public void _ActivateTargetMode(int abIndex, int AOE, _TargetType type, TargetModeCallBack sCallBack, ExitTargetModeCallBack eCallBack)
        {
            GridManager.AbilityTargetSelectMode(this.AbilityTargetSelected, this.SetTargetModeHoveredTile, this.ClearTargetModeHoveredTile);

            targetMode   = true;
            abilityIndex = abIndex;

            targetModeAOE  = AOE;
            targetModeType = type;

            targetSelectedCallBack = sCallBack;
            exitTargetCallBack     = eCallBack;

            OverlayManager.DisableTileCursor();

            TBTK.OnAbilityTargetMode(true);
        }
Пример #2
0
 public static void ActivateTargetMode(Tile tile, UnitAbility ability, int abIndex, TargetModeCallBack sCallBack, ExitTargetModeCallBack eCallBack)
 {
     instance.ActivateTargetModeUnit(tile, ability, abIndex, sCallBack, eCallBack);
 }
Пример #3
0
        //~ public void ActivateTargetModeUnit(Tile tile, int range, int AOE, bool normalAttack, bool requireDirectLOS, _TargetType type, TargetModeCallBack sCallBack, TargetModeCallBack eCallBack){
        public void ActivateTargetModeUnit(Tile tile, UnitAbility ability, int abIndex, TargetModeCallBack sCallBack, ExitTargetModeCallBack eCallBack)
        {
            TBTK.OnUnitABTargetMode(abIndex);
            _ActivateTargetMode(abIndex, ability.GetAOERange(), ability.targetType, sCallBack, eCallBack);

            if (!ability.AttackInLine())
            {
                if (!ability.normalAttack)
                {
                    if (targetModeType == _TargetType.EmptyTile)
                    {
                        targetModeTileList = GridManager.GetTilesWithinDistance(tile, ability.GetRange(), true);
                    }
                    else
                    {
                        targetModeTileList = GridManager.GetTilesWithinDistance(tile, ability.GetRange());
                    }
                }
                else
                {
                    targetModeTileList = new List <Tile>();
                    List <Tile> tilesInRangeList = GridManager.GetTilesWithinDistance(tile, ability.GetRange());

                    int         sight = tile.unit.GetSight();
                    List <Unit> allFriendlyUnitList = FactionManager.GetAllUnitsOfFaction(tile.unit.factionID);

                    for (int i = 0; i < tilesInRangeList.Count; i++)
                    {
                        Tile targetTile = tilesInRangeList[i];

                        if (!GameControl.EnableFogOfWar() && !GameControl.AttackThroughObstacle())
                        {
                            if (!FogOfWar.InLOS(tile, targetTile, 0))
                            {
                                continue;
                            }
                        }

                        bool inSight = GameControl.EnableFogOfWar() ? false : true;
                        if (GameControl.EnableFogOfWar())
                        {
                            if (FogOfWar.InLOS(tile, targetTile) && GridManager.GetDistance(tile, targetTile) <= sight)
                            {
                                inSight = true;
                            }
                            else if (!ability.requireDirectLOS)
                            {
                                for (int n = 0; n < allFriendlyUnitList.Count; n++)
                                {
                                    if (allFriendlyUnitList[n] == tile.unit)
                                    {
                                        continue;
                                    }
                                    if (GridManager.GetDistance(allFriendlyUnitList[n].tile, targetTile) > allFriendlyUnitList[n].GetSight())
                                    {
                                        continue;
                                    }
                                    if (FogOfWar.InLOS(allFriendlyUnitList[n].tile, targetTile))
                                    {
                                        inSight = true;
                                        break;
                                    }
                                }
                            }
                        }

                        if (inSight)
                        {
                            targetModeTileList.Add(targetTile);
                        }
                    }
                }
            }
            else
            {
                /*
                 * List<Tile> neighbourList=tile.GetNeighbourList();
                 * for(int i=0; i<neighbourList.Count; i++){
                 *      bool walkableOnly=(ability.type==UnitAbility._AbilityType.ChargeAttack);
                 *      List<Tile> tileList=GridManager.GetTilesInALine(tile, neighbourList[i], ability.GetRange(), walkableOnly);
                 *
                 *      if(tileList.Count>0){
                 *              if(targetModeType!=_TargetType.EmptyTile) targetModeTileList.Add(tileList[tileList.Count-1]);
                 *              else if (tileList[tileList.Count-1].unit==null) targetModeTileList.Add(tileList[tileList.Count-1]);
                 *      }
                 * }
                 */
            }

            //for(int i=0; i<targetModeTileList.Count; i++) targetModeTileList[i].SetState(_TileState.Range);
            OverlayManager.ShowAbilityRangeIndicator(targetModeTileList);
        }
Пример #4
0
 public void ActivateTargetModeFaction(int AOE, _TargetType type, int abIndex, TargetModeCallBack sCallBack, ExitTargetModeCallBack eCallBack)
 {
     TBTK.OnFactionABTargetMode(abIndex);
     _ActivateTargetMode(abIndex, AOE, type, sCallBack, eCallBack);
 }