Beispiel #1
0
            public StrongholdData ToStrongholdData()
            {
                if (unitDataScriptable == null && constructDataScriptable == null)
                {
                    return(null);
                }

                return(StrongholdData.Create(constructDataScriptable.ToData(), unitDataScriptable.ToData()));
            }
Beispiel #2
0
        public static LevelData FillWithStrongholds(this LevelData data)
        {
            data.StrongholdDatas.Fill(
                StrongholdData.Create(
                    new ConstructData(null, string.Empty, ScriptableObject.CreateInstance <ConstructDataScriptable>()),
                    new UnitData(null, string.Empty, ScriptableObject.CreateInstance <UnitDataScriptable>())
                    )
                );

            data.StrongholdConstructGameObjectFactories.Fill(ScriptableObject.CreateInstance <GameObjectFactory>());
            data.StrongholdUnitGameObjectFactories.Fill(ScriptableObject.CreateInstance <GameObjectFactory>());

            return(data);
        }
        public IObservable <UniRx.Unit> SetUpStronghold(Map map, Coordinate coordinate)
        {
            return(Observable.Create <UniRx.Unit>(
                       observer =>
            {
                var unit = map.Get <Unit>(coordinate);
                var construct = map.Get <Construct>(coordinate);

                map.Set(coordinate, new Stronghold(StrongholdData.Create(construct.Data, unit.Data), coordinate));
                map.Set <Unit>(coordinate, null);
                map.Set <Construct>(coordinate, null);

                observer.OnNext(UniRx.Unit.Default);
                observer.OnCompleted();

                _modifiedEventStream.OnNext(UniRx.Unit.Default);

                return Disposable.Empty;
            }
                       ));
        }
 private static void CreateStrongholdInIndex(LevelData levelData, int index)
 {
     levelData.StrongholdDatas[index] = StrongholdData.Create(levelData.ConstructDatas[index], levelData.UnitDatas[index]);
     levelData.StrongholdConstructGameObjectFactories[index] = levelData.ConstructGameObjectFactories[index];
     levelData.StrongholdUnitGameObjectFactories[index]      = levelData.UnitGameObjectFactories[index];
 }