Ejemplo n.º 1
0
        public int OnMaxNeighborsChange(RuleBehavior ruleBehavior, int direction)
        {
            int rbIndex = ruleBehavior.transform.GetSiblingIndex();

            SaveLoadManager.Instance.SetMaxNeighbors(rbIndex,
                                                     CAMath.Mod(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_MaxNumNeighbors + direction, 9)); //9 directions
            return(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_MaxNumNeighbors);
        }
Ejemplo n.º 2
0
        public int OnThenColorChange(RuleBehavior ruleBehavior, int direction)
        {
            int rbIndex = ruleBehavior.transform.GetSiblingIndex();

            //then color cannot be transparent
            SaveLoadManager.Instance.SetThenColor(rbIndex,
                                                  CAColor.ChangeColorInt(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_ThenColor, direction));
            return(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_ThenColor);
        }
Ejemplo n.º 3
0
        public void DeleteRule(RuleBehavior ruleBehavior)
        {
            int ruleIndex = ruleBehavior.transform.GetSiblingIndex();

            SaveLoadManager.Instance.DeleteRule(ruleIndex);
            Destroy(ruleBehavior.gameObject);

            StartCoroutine(OnAfterDeleteRule());
        }
Ejemplo n.º 4
0
        public int OnIfColorChange(RuleBehavior ruleBehavior, int direction)
        {
            int rbIndex = ruleBehavior.transform.GetSiblingIndex();

            //concerning cells of color 'any' is fine here
            SaveLoadManager.Instance.SetIfColor(rbIndex,
                                                CAColor.ChangeColorInt(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_IfColor, direction, b_includeClear: true));

            return(SaveLoadManager.Instance.CurrentRuleset[rbIndex].m_IfColor);
        }
Ejemplo n.º 5
0
        private void AddRuleUI(RuleData rd, bool b_locked = false)
        {
            //create new rule UI
            RuleBehavior rb = Instantiate(m_RuleBehaviorPrefab);

            rb.transform.SetParent(m_RulesetParent);
            rb.txtRuleX.text = String.Format(RuleBehavior.c_RuleXString, (rb.transform.GetSiblingIndex() + 1).ToString());
            rb.SetLocked(b_locked);

            //Initialize all ui elements in from ruledata
            rb.UpdateAllUI(rd);
        }