public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        NumberInfo ni = GetComponentInChildren <NumberInfo>();

        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            if (ni)
            {
                ni.SetNumber(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
            }
            else
            {
                Debug.Log("ERROR: no number in this flower!:" + name);
            }
        }
        else
        {
            if (ni)
            {
                NumberManager.inst.DestroyOrPool(ni);
//				Destroy(ni.gameObject); // this flower shouldn't exist, but was included with the prefab .. so we destroy it after placement because json says it shouldn't have a numberinfo
            }
            else
            {
                Debug.Log("ERROR: no number in this flower!:" + name);
            }
        }
    }
Ejemplo n.º 2
0
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        if (GetComponentInChildren <NumberInfo>())
        {
            if (N.GetKeys().Contains(Fraction.fractionKey))
            {
                Fraction newFrac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
                GetComponentInChildren <NumberInfo>().SetNumber(newFrac);                // should only be one (for the starting case...)
            }
//			if (N.GetKeys().Contains(typeKey)){
            // EDIT we're going to just have 2 prefabs, its easier
//				if (N[typeKey] == SnailType.Factors.ToString()){
//					type = SnailType.Factors;
//				} else if (N[typeKey] == SnailType.Multiples.ToString()){
//					type = SnailType.Multiples;
//				}
//			}
//			if (N.GetKeys()
        }
        else
        {
            Debug.LogWarning("Monster blob had no number to set props to!");
        }
    }
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);

        Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);

        looseSphere.SetNumber(f);
    }
Ejemplo n.º 4
0
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
//		WebGLComm.inst.Debug("Sheep trigger set prop:"+N.ToString());
        base.SetProperties(N);
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            sheepTrigger.sheepNeeded = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
        }
    }
Ejemplo n.º 5
0
 void SetPropertiesFraction(SimpleJSON.JSONClass N)
 {
     frac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
     SetSkyCamText();
     foreach (NumberInfo ni  in GetComponentsInChildren <NumberInfo>())        // this shouldn't exist, it basically is saying if you modify this object's properties while in edit mode, its children (which shoulnd't have been produced yet) should also change..
     {
         ni.SetNumber(frac, false, false);
     }
 }
    public void SetProperties(SimpleJSON.JSONClass N)
    {
//		Debug.Log("N:"+N.ToString());
        if (N.GetKeys().Contains(key))
        {
            frac    = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, (SimpleJSON.JSONClass)N[key]);
            dropped = N[key][droppedKey].AsBool;
//			WebGLComm.inst.Debug("Set prop on resource;"+N.ToString());
        }
    }
    void SetPropertiesFraction(SimpleJSON.JSONClass N)
    {
        frac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
//		// commented Debug.Log("setting frac prop:"+frac+", N tr;"+N.ToString());
        foreach (NumberInfo ni  in GetComponentsInChildren <NumberInfo>())
        {
            ni.SetNumber(frac, false, false);
        }
//		// commented Debug.Log("setting FRAC prop:"+frac);
    }
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);

        SetHoopFraction(f);

        /*
         * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method.
         * */
        //		// commented Debug.Log("props:"+props);
    }
Ejemplo n.º 9
0
 public override void SetProperties(SimpleJSON.JSONClass N)
 {
     base.SetProperties(N);
     if (N.GetKeys().Contains(wallCreatorRoundKey))
     {
         SetPropertiesSize(N);
     }
     if (N.GetKeys().Contains(Fraction.fractionKey))
     {
         SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
     }
 }
Ejemplo n.º 10
0
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);

        f = Fraction.ReduceFully(f);

        SetNumber(f);

        /*
         * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method.
         * */
    }
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        // we use the generic fraction key.
//		Debug.Log("setprop endoor:"+N.ToString());
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            SetMaxCharge(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
        }
        // For setting current charge we use the specific key (this can't be set during level builder editing mode)
        if (N.GetKeys().Contains(LevelMachineBattery.currentChargeKey))
        {
            SetCurrentCharge(JsonUtil.ConvertJsonToFraction(LevelMachineBattery.currentChargeKey, N));
        }
    }
    //	public override void SetFraction(string fraction){
    //		// nothing this doesn't have fraction.
    //	}

    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
//		// commented Debug.Log("set prop on obj:"+name+", prop:"+N.ToString());
        if (N.GetKeys().Contains(wallCreatorSquareKey))
        {
            SetPropertiesSize(N);
        }

        // move following to base.setprop?
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
        }
    }
    // When the menu is activated, pull the fraction property information from the current object and populate the inputs accordingly.

    public override void OnMenuOpened()
    {
//		// commented Debug.Log("ui fraction setter opened");
        if (!LevelBuilder.inst.currentPiece)
        {
            return;
        }
        SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties();
        Fraction             f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);

//		// commented Debug.Log("ui fractions getter got fraction:"+f.numerator+","+f.denominator);
        numeratorInput.text = f.numerator.ToString();
//		// commented Debug.Log("numerator text is now;"+numeratorInput.text);
        denominatorInput.text = f.denominator.ToString();
    }
    // When the menu is activated, pull the fraction property information from the current object and populate the inputs accordingly.



    public override void OnMenuOpened()
    {
        //		// commented Debug.Log("ui fraction setter opened");
        if (!LevelBuilder.inst.currentPiece)
        {
            return;
        }
        SimpleJSON.JSONClass N         = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties();
        Fraction             lowerFrac = JsonUtil.ConvertJsonToFraction(NumberWallCreatorSquareRandom.fractionLowerKey, N);
        Fraction             upperFrac = JsonUtil.ConvertJsonToFraction(NumberWallCreatorSquareRandom.fractionUpperKey, N);

        numeratorInputLower.text   = lowerFrac.numerator.ToString();
        denominatorInputLower.text = lowerFrac.denominator.ToString();
        numeratorInputUpper.text   = upperFrac.numerator.ToString();
        denominatorInputUpper.text = upperFrac.denominator.ToString();
    }
    void SetPropertiesFraction(SimpleJSON.JSONClass N)
    {
        if (N.GetKeys().Contains(fractionLowerKey))
        {
            lowerFrac = JsonUtil.ConvertJsonToFraction(fractionLowerKey, N);
        }
        if (N.GetKeys().Contains(fractionUpperKey))
        {
            upperFrac = JsonUtil.ConvertJsonToFraction(fractionUpperKey, N);
        }

        foreach (NumberInfo ni  in GetComponentsInChildren <NumberInfo>())
        {
            Fraction f = GetFractionFromIndex(0);
            ni.SetNumber(f, false, false);
        }
//		// commented Debug.Log("setting FRAC prop:"+frac);
    }
Ejemplo n.º 16
0
    // upoffset     }

    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            frac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
            ElevatorMoveTo(frac);
        }
        if (N.GetKeys().Contains(NumberRiser.heightScaleKey))
        {
            SetScale(N[NumberRiser.heightScaleKey].AsFloat);
        }

        /*
         * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method.
         * */

        //		SimpleJSON.JSONNode n = SimpleJSON.JSON.Parse(props);
    }
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
//		// commented Debug.Log("setprop:"+N.ToString());
        base.SetProperties(N);
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            foreach (NumberInfo ni in spikeyChildren)
            {
                Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
                frac = f;
                ni.SetNumber(f);
                MonsterAIRevertNumber mairn = ni.GetComponent <MonsterAIRevertNumber>();
                if (mairn)
                {
                    mairn.SetNumber(f);
                }
//				// commented Debug.Log("set spikey num;"+ni.fraction);
            }
        }
    }
Ejemplo n.º 18
0
 public override void SetProperties(SimpleJSON.JSONClass N)
 {
     base.SetProperties(N);
     if (N.GetKeys().Contains(Fraction.fractionKey))
     {
         foreach (AINumberTower tw in towers)
         {
             Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
             frac = f;
             tw.SetBaseFraction(f);
             tw.BuildTower();
         }
     }
     if (N.GetKeys().Contains(AINumberTower.towerHeightKey))
     {
         foreach (AINumberTower tw in towers)
         {
             tw.SetMaxTowerHeight(N[AINumberTower.towerHeightKey].AsInt);
         }
     }
 }
Ejemplo n.º 19
0
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        // For setting properties via FractinValueUIComm in level builder
        // we use the generic fraction key.
//		Debug.Log("setprop endoor:"+N.ToString());
//		if (N.GetKeys().Contains(activatedKey)){
//
//			activated = N[activatedKey].AsBool;
//		}
        if (N.GetKeys().Contains(Fraction.fractionKey))
        {
            SetMaxCharge(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
        }
        // For setting current charge we use the specific key (this can't be set during level builder editing mode)
        if (N.GetKeys().Contains(LevelMachineBattery.currentChargeKey))
        {
            // Note this setcurrentcharge will pass a levelwasjustloaded=true to LevelMachineBattery to distinguish whether the user completed this action
            // or it was completed beacuse the level was just loaded
            SetCurrentCharge(JsonUtil.ConvertJsonToFraction(LevelMachineBattery.currentChargeKey, N));
        }
    }
 public override void SetProperties(SimpleJSON.JSONClass N)
 {
     base.SetProperties(N);
     spikeyFraction = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N);
 }
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        lamp.lampNumber.SetNumber(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
//		// commented Debug.Log("set:"+lamp.lampNumber+" to;"+lamp.lampNumber.fraction.ToString());
    }
Ejemplo n.º 22
0
    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
//		CreateWall();
    }
Ejemplo n.º 23
0
    // upoffset     }

    public override void SetProperties(SimpleJSON.JSONClass N)
    {
        base.SetProperties(N);
        knight.SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N));
    }