Ejemplo n.º 1
0
            public StrongholdData ToStrongholdData()
            {
                if (unitDataScriptable == null && constructDataScriptable == null)
                {
                    return(null);
                }

                return(StrongholdData.Create(constructDataScriptable.ToData(), unitDataScriptable.ToData()));
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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;
            }
                       ));
        }
Ejemplo n.º 4
0
 private void OnDataChanged([CanBeNull] StrongholdData data)
 {
     toggle.isOn = data != null;
 }
Ejemplo n.º 5
0
 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];
 }