public override bool ValidateCoord(Coord loc, VEntityComponentSystemManager boardState)
        {
            VEntity unit = boardState.GetSystem <UnitFinderSystem>().GetUnitAtCoord(loc);

            if (unit != null)
            {
                return(unit.GetVComponent <TeamComponent>().team == team);
            }

            return(false);
        }
        public override List <Coord> SelectGroupCoords(Coord loc, Coord casterLoc, VEntityComponentSystemManager boardState)
        {
            List <Coord> selectedCoords = new List <Coord>();
            Coord        dir            = Coord.GetDirection(casterLoc, loc);
            Coord        current        = casterLoc;

            while (boardState.GetSystem <TerrainCellFinderSystem>().IsValidCell(current))
            {
                VEntity unit = boardState.GetSystem <UnitFinderSystem>().GetUnitAtCoord(current);
                if (unit != null)   //&&unit.team == team
                {
                    break;
                }
                current += dir;
            }
            if (current != casterLoc)
            {
                selectedCoords.Add(current);
            }
            return(selectedCoords);
        }
        public override List <Coord> SelectGroupCoords(Coord loc, Coord casterLoc, VEntityComponentSystemManager boardState)
        {
            List <Coord> selectedCoords = new List <Coord>();
            Coord        dir            = Coord.GetDirection(casterLoc, loc);
            Coord        current        = casterLoc + dir;

            while (boardState.GetSystem <TerrainCellFinderSystem>().GetCellAtCoord(current) != null)
            {
                selectedCoords.Add(current);
                current += dir;
            }
            return(selectedCoords);
        }
        public override List <Coord> SelectGroupCoords(Coord loc, Coord casterLoc, VEntityComponentSystemManager boardState)
        {
            List <Coord> selectedCoords = new List <Coord>();

            foreach (Coord direction in Coord.cardinalCoords)
            {
                for (int distance = offset + 1; infinite || distance <= length; distance++)
                {
                    Coord newCoord = casterLoc + (direction * distance);
                    if (boardState.GetSystem <TerrainCellFinderSystem>().IsValidCell(newCoord))
                    {
                        selectedCoords.Add(newCoord);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(selectedCoords);
        }
Beispiel #5
0
 void HandleLeftClick()
 {
     if (State == InputState.SELECTCARD)
     {
         if (cardHovering != null)
         {
             //cardController.AttemptPlayCard(cardHovering);
             if (cardController.IsPlayable(cardHovering.cardEntityId))
             {
                 cardSelected = cardHovering;
                 cardMover.ClickCard(cardSelected);
                 State = InputState.SELECTSPACE;
                 cardController.MyHandState = HandState.SELECTED;
             }
         }
     }
     else if (State == InputState.SELECTSPACE)
     {
         IEnumerable <VEntity> playableUnitIds = boardState.GetSystem <UnitFinderSystem>().GetAllPlayerUnits();
         if (boardSpaceHovering != Coord.nullCoord)
         {
             Debug.Log("Clicking space");
             int             belongs       = 0;
             IList <VEntity> belongingList = new List <VEntity>();
             foreach (VEntity v in playableUnitIds)
             {
                 if (boardState.GetAnimationSystem <PlayCardSystem>().IsSpaceInRange(boardSpaceHovering, v.id))
                 {
                     belongs++;
                     belongingList.Add(v);
                 }
             }
             Debug.Log(belongs);
             if (belongs == 0)
             {
                 //invalid space
             }
             else
             {
                 spaceSelected = boardSpaceHovering;
                 if (belongs > 1)
                 {
                     State = InputState.CONFLICTRESOLUTION;
                 }
                 else if (belongs == 1)
                 {
                     FinishPlayingCard(cardSelected, spaceSelected, belongingList[0]);
                 }
             }
         }
     }
     else if (State == InputState.CONFLICTRESOLUTION)
     {
         if (boardSpaceHovering != Coord.nullCoord)
         {
             VEntity selectedChar = boardState.GetSystem <UnitFinderSystem>().GetUnitAtCoord(boardSpaceHovering);
             if (selectedChar != null)
             {
                 CharacterClassComponent charClass = selectedChar.GetVComponent <CharacterClassComponent>();
                 if (charClass != null)
                 {
                     FinishPlayingCard(cardSelected, spaceSelected, selectedChar);
                 }
             }
         }
     }
 }
 public override bool ValidateCoord(Coord loc, VEntityComponentSystemManager boardState)
 {
     return(shouldBeOccupied == (boardState.GetSystem <UnitFinderSystem>().GetUnitAtCoord(loc) != null));
 }