private void OnGrow(int nb) { StopAllCoroutines(); LegumeManager.State currentState = _state; _state = (LegumeManager.State)((int)(_state + nb) % 4); Debug.Log(M_Cellule + " OnGrow : " + currentState + " => " + _state); _spriteRenderer.sprite = LegumeManager.GetInstance().GetLegumeInfo(Type).m_Sprites[(int)_state]; switch (_state) { case LegumeManager.State.Graine: OnChangeStateGraine(); break; case LegumeManager.State.Pousse: OnChangeStatePousse(); break; case LegumeManager.State.Recolte: OnChangeStateRecolte(); break; case LegumeManager.State.Pourri: OnChangeStatePourri(); break; } //OnState.Invoke(_state); }
public int Recolter() { //*/ if (_state == LegumeManager.State.Recolte) { OnGrow(-1); return(Mathf.FloorToInt(_catalyse * LegumeManager.GetInstance().GetLegumeInfo(Type).m_Product)); } return(0); }
// Use this for initialization private void Start() { if (_instance) { Destroy(_instance); } _instance = this; if (_legumesDictionary == null) { _legumesDictionary = new Dictionary <Type, LegumeStruct>(); } }
public void Planter(LegumeManager.Type type) { if (!Legume) { GameObject legumePrefab = LegumeManager.GetInstance().GetLegumeInfo(type).m_Prefab; GameObject legume = Instantiate(legumePrefab); legume.name = type.ToString(); legume.transform.SetParent(LegumePosition, false); Legume = legume.GetComponent <Legume>(); Legume.M_Cellule = this; } }
private void ChangeMonth(int month) { LegumeManager.State requestState = LegumeManager.GetInstance().GetLegumeInfo(Type).m_Calendar[month]; switch (requestState) { case LegumeManager.State.Graine: if (_state == LegumeManager.State.Pourri) { OnGrow(1); } break; case LegumeManager.State.Pousse: if (_state == LegumeManager.State.Graine) { OnGrow(1); } break; case LegumeManager.State.Recolte: if (_state == LegumeManager.State.Pousse) { OnGrow(1); } break; case LegumeManager.State.Pourri: if (_state == LegumeManager.State.Graine) { M_Cellule.Supprimer(); } else if (_state == LegumeManager.State.Pousse) { OnGrow(2); } else if (_state == LegumeManager.State.Recolte) { OnGrow(1); M_Cellule.Fertiliser(1); } break; } }
private void Bufferise(bool active) { if (active) { foreach (var buffInfo in LegumeManager.GetInstance().GetLegumeInfo(Type).m_Buffs) { Cellule.Buff buff = new Cellule.Buff(buffInfo, this); _activeBuffs.Add(buff); M_Cellule.Bufferise(buff); } } else { foreach (var buff in _activeBuffs) { M_Cellule.UnBufferise(buff); } _activeBuffs.Clear(); } }