Exemplo n.º 1
0
 private void OnPlanetChange(PlanetModel value)
 {
     _planet       = value;
     _selectedLife = _planet.Life;
     //if( _selectedLife.Resistance.Count > 0 )
     //  UpdatePlanetMapColors();
 }
Exemplo n.º 2
0
    public LootBoxModel()
    {
        if (Instance != null)
        {
            Debug.LogWarning("Replacing the current model!");
        }
        Instance = this;

        List <Units> unitTypes = Enum.GetValues(typeof(Units)).Cast <Units>().ToList();

        Resources = new Dictionary <Units, Resource>();
        for (int i = 0; i < unitTypes.Count; i++)
        {
            Units type = unitTypes[i];
            Resources.Add(type, new Resource(type, 0));
        }

        UpgradeManager          = new UpgradeManager(this);
        UpgradeManager.IsActive = true;
        Time = new TimeModel(this);

        Life          = new LifeModel(this);
        Life.IsActive = true;

        Job          = new JobModel(this);
        Job.IsActive = false;

        MacGuffinQuest          = new MacGuffinQuest(this);
        MacGuffinQuest.IsActive = false;

        Influencer          = new InfluencerModel(this);
        Influencer.IsActive = false;

        Studio          = new StudioModel(this);
        Studio.IsActive = false;

        Public          = new PublicModel(this);
        Public.IsActive = false;

        SetInitialState();

#if DEBUG
        if (UnlockAllViews)
        {
            Life.IsActive           = true;
            UpgradeManager.IsActive = true;
            Job.IsActive            = true;
            MacGuffinQuest.IsActive = true;
            Influencer.IsActive     = true;
            Studio.IsActive         = true;
            Public.IsActive         = true;
        }
#endif
    }
Exemplo n.º 3
0
 private void OnPlanetChange(PlanetModel value)
 {
     _life = value.Life;
     RemoveAllChildren(Container);
     for (int i = 0; i < _life.BuildingsState.Count; i++)
     {
         GameObject         ability_go        = Instantiate(AbilityUnlockPrefab, Container);
         BuildingUnlockView abilityUnlockView = ability_go.GetComponent <BuildingUnlockView>();
         abilityUnlockView.Setup(_life.BuildingsState[i], EffectPrefab);
     }
 }
Exemplo n.º 4
0
    private void OnPlanetModelChange(PlanetModel value)
    {
        RemoveAllChildren(gameObject.transform);

        _unitsGO = new Dictionary <UnitModel, GameObject>();
        _life    = value.Life;
        for (int i = 0; i < _life.Units.Count; i++)
        {
            AddUnit(_life.Units[i]);
        }
        disposables.Clear();
        _life.Units.ObserveAdd().Subscribe(_ => AddUnit(_.Value)).AddTo(disposables);
        _life.Units.ObserveRemove().Subscribe(_ => RemoveUnit(_.Value)).AddTo(disposables);
    }
Exemplo n.º 5
0
    private void OnPlanetModelChange(PlanetModel value)
    {
        RemoveAllChildren(gameObject.transform);

        _children = new Dictionary <LifeElementModel, GameObject>();
        _life     = value.Life;
        foreach (KeyValuePair <int, LifeElementModel> item in _life.Elements)
        {
            Add(item.Value);
        }
        disposables.Clear();
        _life.Elements.ObserveAdd().Subscribe(_ => Add(_.Value)).AddTo(disposables);
        _life.Elements.ObserveRemove().Subscribe(_ => Remove(_.Value)).AddTo(disposables);
    }
Exemplo n.º 6
0
    ///////////////////////// HANDLERS ////////////////////////////

    private void OnPlanetChange(PlanetModel value)
    {
        _hexMapModel = value.Map;
        _life        = value.Life;

        for (int i = 0; i < _life.Units.Count; i++)
        {
            _tempUnitModel = _life.Units[i];
            _tempUnitModel.Props[R.Altitude].Value = _hexMapModel.Table[_tempUnitModel.X][_tempUnitModel.Y].Props[R.Altitude].Value; //not sure if this is needed? only if regenerating planets, but keeping units
            _tempUnitModel.Y = _tempUnitModel.Y;                                                                                     //update position vector3
            _hexMapModel.Table[_tempUnitModel.X][_tempUnitModel.Y].Unit = _tempUnitModel;
            _unitDefenseUpdateCommand.Execute(_tempUnitModel);
            _tempUnitModel.Setup();
        }
    }
Exemplo n.º 7
0
    private void OnPlanetModelChange(PlanetModel value)
    {
        _life = value.Life;
        disposables.Clear();

        _life.Props[R.Population]._Value.Subscribe(_ => Population.SetValue(_)).AddTo(disposables);

        /*
         * _life.Props[ R.Energy ]._Value.Subscribe( _ => Food.SetValue( _, _life.Props[ R.Energy ].Delta ) ).AddTo( disposables );
         * _life.Props[ R.Science ]._Value.Subscribe( _ => Science.SetValue( _, _life.Props[ R.Science ].Delta ) ).AddTo( disposables );
         * _life.Props[ R.Minerals ]._Value.Subscribe( _ => Words.SetValue( _, _life.Props[ R.Minerals ].Delta ) ).AddTo( disposables );
         *
         * _life.Props[ R.Energy ]._Delta.Subscribe( _ => Food.SetValue( _life.Props[ R.Energy ].Value, _ ) ).AddTo( disposables );
         * _life.Props[ R.Science ]._Delta.Subscribe( _ => Science.SetValue( _life.Props[ R.Science ].Value, _ ) ).AddTo( disposables );
         * _life.Props[ R.Minerals ]._Delta.Subscribe( _ => Words.SetValue( _life.Props[ R.Minerals ].Value, _ ) ).AddTo( disposables );
         */
    }
Exemplo n.º 8
0
    public override void OnDestroy()
    {
        base.OnDestroy();

        GameModel.RemoveHandle <PlanetModel>(OnPlanetChange);
        GameModel.RemoveHandle <UnitModel>(OnUnitChange);
        GameMessage.StopListen <SkillDeactivateAllMessage>(OnSkillDeactivate);

        _tooltipMessage.Action = TooltipAction.HIDE;
        GameMessage.Send(_tooltipMessage);

        _life              = null;
        _skillCommand      = null;
        _pay               = null;
        _tooltipMessage    = null;
        _deactivateMessage = null;
        _unit              = null;
    }
Exemplo n.º 9
0
    public void Execute(HexMap map)
    {
        LifeModel life = _planet.SelectedPlanet.Life;

        _planet.SelectedPlanet.Props[R.Temperature].Value     = map.Temperature.Value;
        _planet.SelectedPlanet.Props[R.Temperature].Variation = map.TemperatureVariation.Value;

        _planet.SelectedPlanet.Props[R.Pressure].Value     = map.Pressure.Value;
        _planet.SelectedPlanet.Props[R.Pressure].Variation = map.PressureVariation.Value;

        _planet.SelectedPlanet.Props[R.Humidity].Value     = map.Humidity.Value;
        _planet.SelectedPlanet.Props[R.Humidity].Variation = map.HumidityVariation.Value;

        _planet.SelectedPlanet.Props[R.Radiation].Value     = map.Radiation.Value;
        _planet.SelectedPlanet.Props[R.Radiation].Variation = map.RadiationVariation.Value;

        _planet.GenerateFromModel(_planet.SelectedPlanet);

        _planet.SelectedPlanet.Life = GameModel.Copy(life);

        _planet.PlanetLoaded();
    }
Exemplo n.º 10
0
 private void OnPlanetModelChange(PlanetModel value)
 {
     _life = value.Life;
 }
Exemplo n.º 11
0
 public void Init(LifeModel model)
 {
     _model     = model;
     _rank.text = "";
     _name.text = model.name;
 }
Exemplo n.º 12
0
 public void Init(int rank, LifeModel model)
 {
     _model     = model;
     _rank.text = rank.ToString();
     _name.text = model.name;
 }
Exemplo n.º 13
0
 public void Reset()
 {
     _lifeModel = null;
 }
Exemplo n.º 14
0
 public void Copy(LifeModel origin)
 {
     _lifeModel = origin;
 }