Пример #1
0
    private void RandomizeWeather()
    {
        WindStrength windStrength = (WindStrength)Random.Range((int)WindStrength.Dead, (int)WindStrength.Storm + 1);
        HexDirection direction    = HexDirectionExtension.ReturnRandomDirection();

        ChangeWindDirectionAndSpeed(direction, windStrength);
    }
Пример #2
0
    public override List <HexCell> GetAffectedCells(HexCell fromCell, HexCell targetCell)
    {
        List <HexCell> affectedCells     = new List <HexCell>();
        HexDirection   directionToTarget = HexDirectionExtension.GetDirectionTo(fromCell, targetCell);

        affectedCells.Add(targetCell);
        affectedCells.AddRange(CellFinder.GetAllCellsInLine(targetCell, directionToTarget, rangeAfterFirstHit, (c) => c.Traversable == true));
        return(affectedCells);
    }
Пример #3
0
    //Creates an AI controlled merchant player with a ship and adds it to controllers
    private void CreateMerchantPlayer(Route route)
    {
        MerchantShip newShip = Instantiate(merchantShip);

        newShip.transform.SetParent(shipParent);
        newShip.Setup(route);

        //Delegates
        newShip.OnShipBoarded   += worldUIView.OpenBoardingView;
        newShip.OnShipInspected += worldUIView.OpenInspectView;

        hexGrid.AddUnit(newShip, route.GetSpawnableLocation(), HexDirectionExtension.ReturnRandomDirection(), false);

        Player newMerchantPlayer = new Player(newShip, null, false);

        MapTurnSystem.instance.AddPlayerToTurnOrder(newMerchantPlayer);
    }
Пример #4
0
    public override void ApplyEffect(Character attacker, Character target, bool crit, bool hostile)
    {
        if (IsValidEffectTarget(hostile))
        {
            HexDirection directionToTarget = HexDirectionExtension.GetDirectionTo(attacker.Location, target.Location);

            HexCell newCell = target.Location;
            for (int i = 0; i < hexes; i++)
            {
                HexCell cellToTry = pull ? newCell.GetNeighbor(HexDirectionExtension.Opposite(directionToTarget)) : newCell.GetNeighbor(directionToTarget);
                if (!target.CanEnter(cellToTry))
                {
                    break;
                }
                newCell = cellToTry;
            }
            target.Location = newCell;
        }
    }
Пример #5
0
    //Creates a player from a prefab and spawns a ship, starting characters and adds them to controllers
    private void CreateHumanPlayer()
    {
        Ship newShip = Instantiate(playerStarterShip);

        newShip.transform.SetParent(shipTransform);

        worldGrid.AddUnit(newShip, worldController.PlayerSpawnPosition, HexDirectionExtension.ReturnRandomDirection(), true);

        combatSystem.managementMap = playerStartingGridMap;

        Player newPlayer = new Player(newShip, true, playerCrewSimulation);

        MapTurnSystem.instance.AddPlayerToFirstPositionInTurnOrder(newPlayer);
        HexGridController.player = newPlayer;
        newPlayer.PlayerData.NextBountyChange = setupData.difficultySettings.bountyChanges;
        for (int i = 0; i < startingCharacters.Length; i++)
        {
            HexGridController.SpawnCharacterForPlayerCrew(startingCharacters[i]);
        }
        OnPlayerCreated?.Invoke(newPlayer);
    }
Пример #6
0
    public override List <HexCell> GetAffectedCells(HexCell fromCell, HexCell targetCell)
    {
        List <HexCell> affectedCells = new List <HexCell>();

        affectedCells.Add(targetCell);

        //Sides
        HexDirection dirToSelected = HexDirectionExtension.GetDirectionToNeighbor(fromCell, targetCell);
        HexCell      previousCell  = Utility.TestVariableAgainstConditions(fromCell.GetNeighbor(dirToSelected.Previous()), (c) => c.Traversable == true);

        if (previousCell)
        {
            affectedCells.Add(previousCell);
        }
        HexCell nextCell = Utility.TestVariableAgainstConditions(fromCell.GetNeighbor(dirToSelected.Next()), (c) => c.Traversable == true);

        if (nextCell)
        {
            affectedCells.Add(nextCell);
        }
        return(affectedCells);
    }
Пример #7
0
    //Creates an AI controlled Redcoat player with a ship and adds it to controllers
    private void CreateRedcoatPlayer(Route route)
    {
        PatrolShip newShip = Instantiate(redcoatShip);

        newShip.transform.SetParent(shipParent);
        newShip.Setup(route);

        //Delegates
        newShip.OnShipBoarded   += combatSystem.StartCombat;
        newShip.OnShipInspected += worldUIView.OpenInspectView;

        hexGrid.AddUnit(newShip, route.GetSpawnableLocation(), HexDirectionExtension.ReturnRandomDirection(), false);

        List <Character> newCrew = new List <Character>();

        for (int i = 0; i < GetCrewSize(HexGridController.player.PlayerData); i++)
        {
            newCrew.Add(Utility.ReturnRandom(redcoatCharacters));
        }

        Player newRedcoatPlayer = new Player(newShip, newCrew, false);

        MapTurnSystem.instance.AddPlayerToTurnOrder(newRedcoatPlayer);
    }