Stronghold AddStronghold(HexCell cell, SetupData setupData) { Vector3Int tilemapPosition = HexCoordinates.CoordinatesToTilemapCoordinates(cell.coordinates); cell.HasStronghold = true; string strongholdName = setupData.strongholdNames[0]; if (setupData.strongholdNames.Count > 1) { setupData.strongholdNames.RemoveAt(0); } Stronghold newStronghold = new Stronghold(strongholdName, cell, setupData.difficultySettings, worldUIView.EnablePOIInteraction); cell.PointOfInterest = newStronghold; List <HexDirection> openwaterConnections = new List <HexDirection>(); for (HexDirection d = HexDirection.NE; d <= HexDirection.NW; d++) { HexCell neighbor = cell.GetNeighbor(d); if (neighbor && neighbor.IsOcean) { openwaterConnections.Add(d); } } HexDirection dir = Utility.ReturnRandom(openwaterConnections); featuresTilemap.SetTile(tilemapPosition, strongholdTiles[(int)dir]); return(newStronghold); }
public override void TakeDamage(decimal dmg, out Resource returning, out int attackPoints) { base.TakeDamage(dmg, out returning, out attackPoints); Stronghold.BeginUpdate(); Stronghold.Gate = hp; Stronghold.EndUpdate(); }
/// <summary> /// Adds a new Stronghold /// </summary> /// <returns>The new Stronghold's ID</returns> public int addStronghold() { using (logger.DebugCall()) { Stronghold newStronghold = new Stronghold(); _strongholds.Add(newStronghold.ID); return newStronghold.ID; } }
private void SetUpUpdate(int itemsUpdateCount, int configUpdateCount, int mapXSize = 1, int mapYSize = 1) { var mapConfig = MapConfig.Create(mapXSize, mapYSize); var coordinate = new Coordinate(0, 0); var tiles = new[] { new Tile(new TileData(null, string.Empty, null), coordinate) }; var units = new[] { new Unit(new UnitData(null, string.Empty, null), coordinate) }; var construct = new Construct(new ConstructData(null, string.Empty, null), coordinate); var constructs = new[] { construct }; var strongholds = new Stronghold[1]; _mockConfigRepository .Setup(r => r.GetObservableStream()) .Returns(Observable.Repeat(mapConfig, configUpdateCount)); _mockTilesRepository .Setup(r => r.GetObservableStream()) .Returns(Observable.Repeat(tiles, itemsUpdateCount)); _mockUnitsRepository .Setup(r => r.GetObservableStream()) .Returns(Observable.Create <IReadOnlyList <Unit> >( observer => { for (var i = 0; i < itemsUpdateCount; i++) { observer.OnNext(new[] { new Unit(new UnitData(null, (i + 1).ToString(), null), coordinate) }); } observer.OnCompleted(); return(Disposable.Empty); })); _mockConstructsRepository .Setup(r => r.GetObservableStream()) .Returns(Observable.Repeat(constructs, itemsUpdateCount)); _mockStrongholdsRepository .Setup(r => r.GetObservableStream()) .Returns(Observable.Repeat(strongholds, itemsUpdateCount)); _expectedMapWithSetUpMock = new Map(tiles, units, constructs, strongholds, mapConfig); _mapGetService = new MapGetService( _mockConfigRepository.Object, _mockTilesRepository.Object, _mockUnitsRepository.Object, _mockConstructsRepository.Object, _mockStrongholdsRepository.Object ); }
/// <summary> /// Advances time by 8 hours /// Direct call to Scripts AdvanceTimeByHoursNoRest /// </summary> public static void AdvanceTime() { Scripts.AdvanceTimeByHoursNoRest(8); Stronghold stronghold = GameState.Stronghold; if (stronghold != null) { stronghold.AddTurns(1); stronghold.AdvanceOneTurn(); Console.AddMessage("Stronghold turn advanced by 1", Color.green); } }
//public SoldierFactorySystem.SoldierInfo getSoldierInfo(Race pRace, string pSoldierName) //{ // var lStateIndex = soldierNameToStateIndex[pSoldierName]; // State lState = RaceFactoryState[pRace][lStateIndex]; // return lState.info; //} public void createFactory(Race race, Vector3 lPosition, int lStateIndex, Stronghold lStronghold) { State lState = RaceFactoryState[race][lStateIndex]; GameObject lBuilding = zzCreatorUtility.Instantiate( soldierFactorySystem.getFactoryPrefab(race), lPosition, Quaternion.identity, 0); var lFactoryInfo = lState.info; //zzObjectMap.getObject(lFactoryInfo.armyBaseName) // .GetComponent<ArmyBase>() // .addFactory(lFactoryInfo.soldierPrefab,lFactoryInfo.produceInterval, // lFactoryInfo.firstTimeOffset); var lFactory = SoldierFactory.addFactory(lBuilding, lFactoryInfo.soldierPrefab, lFactoryInfo.produceInterval, lFactoryInfo.firstTimeOffset, lFactoryInfo.aiAimList); lFactory.listener = lStronghold.GetComponent<SoldierFactoryListener>().interfaceObject; lStronghold.soldierFactory = lBuilding; decorateFactoryBuild(lBuilding, race, lStateIndex); }
public void createFactory(Race race, Vector3 lPosition, string lSoldierName, Stronghold lStronghold) { createFactory(race, lPosition, soldierNameToStateIndex[lSoldierName], lStronghold); }
public void CreateNode(int level) { m_MapCell = new List <List <Cell> >(); m_Nodes = new List <List <Node> >(); GameObject go = null; Cell cell = null; //地面 //行 for (int i = 0; i < NumOfRow; i++) { List <Cell> cellList = new List <Cell>(); List <Node> nodeList = new List <Node>(); //列 for (int j = 0; j < NumOfColumn; j++) { //Cell 构建方块 Vector2 pos = new Vector2(j * ColumnInterval + ColumnInterval / 2f, -(i * RowInterval + RowInterval / 2f)); Node n = new Node(pos, i, j); nodeList.Add(n); go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Item, "Building/Ground", isCache: true); go.transform.position = pos; go.transform.rotation = Quaternion.identity; go.transform.localScale = new Vector3(1, 1, 1); cell = go.GetComponent <Cell>(); cellList.Add(cell); cell.Init(n); } m_MapCell.Add(cellList); m_Nodes.Add(nodeList); } //要塞 List <StrongholdInfo> strongholdInfoList = GameLevelDBModel.Instance.GetStrongholdInfo(level); for (int i = 0; i < strongholdInfoList.Count; i++) { cell = m_MapCell[strongholdInfoList[i].Row - 1][strongholdInfoList[i].Column - 1]; go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Item, "Building/Stronghold", isCache: true); go.transform.position = cell.transform.position; go.transform.rotation = Quaternion.identity; go.transform.localScale = new Vector3(1, 1, 1); Stronghold s = go.GetComponent <Stronghold>(); s.RefreshCell(cell); s.Init(strongholdInfoList[i].Range); s.Cell.Node.IsObstacle = true; } //怪物 go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Role, "Monster", isCache: true); Vector2 monsterPos = GameLevelDBModel.Instance.GetMonsterRowAndColunm(level); cell = m_MapCell[(int)monsterPos.x - 1][(int)monsterPos.y - 1]; go.transform.position = cell.transform.position; go.transform.rotation = Quaternion.identity; go.transform.localScale = new Vector3(1, 1, 1); RoleCtrl roleCtrl = go.GetComponent <RoleCtrl>();; roleCtrl.RefreshCell(cell); GameLevelSceneCtrl.Instance.SetMonster(roleCtrl); }
public void Setup(Stronghold stronghold) { poiTextTitle.text = stronghold.Name; }