void Update()
    {
        if (eating)
        {
            float mdd = Time.deltaTime * 2;             // eat speed
            eatingNumber.transform.position    = Vector3.MoveTowards(eatingNumber.transform.position, endPoint.position, mdd);
            eatingNumber.transform.localScale *= 0.99f;
            if (Vector3.SqrMagnitude(eatingNumber.transform.position - endPoint.position) < .5f)
            {
                nh.SetProperties(JsonUtil.ConvertFractionToJson(Fraction.fractionKey, eatingNumber.GetComponent <NumberInfo>().fraction));
                Destroy(eatingNumber);
                eating = false;
                AudioManager.inst.PlayItemGetSound();                 //(transform.position,1,false);
                AudioManager.inst.PlayTimerDing();
//				scrollFx = true;
                scrollFxTimer = 1.5f;
            }
        }
        if (scrollFxTimer > 0)
        {
            scrollFxTimer -= Time.deltaTime;
            Vector2 of          = scrollFX.material.GetTextureOffset("_MainTex");
            float   scrollspeed = Time.deltaTime * 2f;
            scrollFX.material.SetTextureOffset("_MainTex", new Vector2(of.x + scrollspeed, of.y));
        }
    }
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();        // new SimpleJSON.JSONClass();
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, looseSphere.fraction, N);

        return(N);
    }
Exemplo n.º 3
0
    public override void SetObjectProperties()
    {
        if (numeratorInput.text.Length == 0 || denominatorInput.text.Length == 0 || numeratorInput.text == "-")
        {
            return;
        }
        base.SetObjectProperties();
        string den = denominatorInput.text.ToString();
//		// commented Debug.Log("den;"+den);
        Fraction userInputtedFraction = new Fraction(int.Parse(numeratorInput.text.ToString()), int.Parse(den));

        SimpleJSON.JSONClass N = new SimpleJSON.JSONClass();
        N[ResourceDrop.key] = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, userInputtedFraction);        // ConvertJsonToFraction(userInputtedFraction);
//		Debug.Log("resource drop:"+N.ToString());
        N[ResourceDrop.droppedKey].AsBool = false;
//		// commented Debug.Log("props:"+props);
        if (LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>())
        {
            LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().SetProperties(N);
        }
        else
        {
            // commented Debug.Log("tried to set frac, but no ueo!"+LevelBuilder.inst.currentPiece.name);
        }
    }
Exemplo n.º 4
0
 public override SimpleJSON.JSONClass GetProperties()
 {
     SimpleJSON.JSONClass N = base.GetProperties();
     N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, towers[0].baseFraction, N);
     N[AINumberTower.towerHeightKey].AsInt = towers[0].towerHeightMax;         // note that this is fragile, depending on there only being one tower in the group OR depending on all towers in group being identical heights
     return(N);
 }
    public override void SetObjectProperties()
    {
        //		// commented Debug.Log("numerator text is now2;"+numeratorInput.text);
        //		// commented Debug.Log("ui fraction setter setting props.");
        //
        //		// commented Debug.Log("num, den:"+numeratorInput.text+","+denominatorInput.text);
        if (numeratorInputLower.text.Length == 0 || denominatorInputLower.text.Length == 0 || numeratorInputLower.text == "-" ||
            numeratorInputUpper.text.Length == 0 || denominatorInputUpper.text.Length == 0 || numeratorInputUpper.text == "-")
        {
            return;
        }
        base.SetObjectProperties();
        //		// commented Debug.Log("den;"+den);
        Fraction lowerFrac = new Fraction(int.Parse(numeratorInputLower.text.ToString()), int.Parse(denominatorInputLower.text.ToString()));
        Fraction upperFrac = new Fraction(int.Parse(numeratorInputUpper.text.ToString()), int.Parse(denominatorInputUpper.text.ToString()));

        SimpleJSON.JSONClass N = JsonUtil.ConvertFractionToJson(NumberWallCreatorSquareRandom.fractionLowerKey, lowerFrac);
        N = JsonUtil.ConvertFractionToJson(NumberWallCreatorSquareRandom.fractionUpperKey, upperFrac, N);

        if (LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>())
        {
            LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().SetProperties(N);
        }
        else
        {
            // commented Debug.Log("tried to set frac, but no ueo!"+LevelBuilder.inst.currentPiece.name);
        }
    }
Exemplo n.º 6
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, sheepTrigger.sheepNeeded, N);
//		WebGLComm.inst.Debug("Sheep trigger get prop:"+N.ToString());
        return(N);
    }
    public SimpleJSON.JSONClass GetProperties(SimpleJSON.JSONClass N)
    {
        N[key] = new SimpleJSON.JSONClass();
        N[key] = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, frac, (SimpleJSON.JSONClass)N[key]);
        N[key][droppedKey].AsBool = dropped;
//		WebGLComm.inst.Debug("get prop on resource;"+N.ToString());
        return(N);
    }
Exemplo n.º 8
0
    public override SimpleJSON.JSONClass GetProperties()
    {
//		Debug.Log("Getting prop.");
        SimpleJSON.JSONClass N = base.GetProperties();
//		Debug.Log("N:"+N.ToString());
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, knight.GetFraction(), N);
        return(N);
    }
Exemplo n.º 9
0
 public override SimpleJSON.JSONClass GetProperties()
 {
     SimpleJSON.JSONClass N = base.GetProperties();
     N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, frac, N);
     N[offsetKey].AsFloat   = offset;
     N[intervalKey].AsFloat = interval;
     return(N);
 }
Exemplo n.º 10
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        //		Dictionary<string,string> properties = new Dictionary<string,string>();
        SimpleJSON.JSONClass N = base.GetProperties();
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, frac, N);
        N[NumberRiser.heightScaleKey].AsFloat = heightScale;

        return(N);

//		return N;
    }
Exemplo n.º 11
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        // For getting the data about how much charge was collected (as a result of user playing and inserting charge into the battery), use our specific currentchargeKey
        SimpleJSON.JSONClass N = base.GetProperties();
        N = JsonUtil.ConvertFractionToJson(LevelMachineBattery.currentChargeKey, battery.totalChargeCollected, N);
        // For reporting max charge to Fraction setter in UI which doesn't know about maxChargeKey, we use the generic fraction key
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, battery.maxCharge, N);
//		N[activatedKey].AsBool = activated;
//		Debug.Log("got prop:"+N.ToString());
        return(N);
    }
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, frac, N);
        N[wallCreatorSquareKey][wallXkey] = wallX.ToString();
        N[wallCreatorSquareKey][wallYkey] = wallY.ToString();
        N[wallCreatorSquareKey][wallZkey] = wallZ.ToString();

//		// commented Debug.Log("getting prop:"+N.ToString());
        return(N);
    }
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();
        N = JsonUtil.ConvertFractionToJson(fractionLowerKey, lowerFrac, N);
        N = JsonUtil.ConvertFractionToJson(fractionUpperKey, upperFrac, N);
//		N[JsonLevelLoader.inst.fracSequenceLengthKey].AsInt = maxFracSeqSteps;
        N[wallCreatorSquareKey][wallXkey] = wallX.ToString();
        N[wallCreatorSquareKey][wallYkey] = wallY.ToString();
        N[wallCreatorSquareKey][wallZkey] = wallZ.ToString();
        return(N);
    }
Exemplo n.º 14
0
 public override SimpleJSON.JSONClass GetProperties()
 {
     SimpleJSON.JSONClass N = base.GetProperties();
     N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, frac, N);
     //		if (degreesToComplete == 0) degreesToComplete = 360;
     N[wallCreatorRoundKey] = new SimpleJSON.JSONClass();
     N[wallCreatorRoundKey][wallDegreesKey] = degreesToComplete.ToString();
     N[wallCreatorRoundKey][wallRadiusKey]  = radius.ToString();
     N[wallCreatorRoundKey][wallHeightKey]  = height.ToString();
     //		// commented Debug.Log("getting prop:"+N.ToString());
     return(N);
 }
Exemplo n.º 15
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();

        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, energyFrac, N);
//			WebGLComm.inst.Debug("get prop vehicle. energyfrac;"+energyFrac);

        //		new SimpleJSON.JSONClass();
        //		N[GameManager.inst.numeratorKey] = fraction.numerator.ToString();
        //		N[denominatorKey] = fraction.denominator.ToString();
//		WebGLComm.inst.Debug("getting prop on vehicl:"+myName+",n:"+N.ToString());
        return(N);
    }
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N  = base.GetProperties();
        NumberInfo           ni = GetComponentInChildren <NumberInfo>();

        if (ni)
        {
            return(JsonUtil.ConvertFractionToJson(Fraction.fractionKey, ni.fraction, N as SimpleJSON.JSONClass));
        }
        else
        {
            return(N);
        }
    }
Exemplo n.º 17
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        SimpleJSON.JSONClass N = base.GetProperties();
        if (GetComponentInChildren <NumberInfo>())
        {
            N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, GetComponentInChildren <NumberInfo>().fraction, N);
        }
        else
        {
            Debug.LogWarning("Monster blob had no number to get props from!");
//			return new SimpleJSON.JSONClass(); // oops, no number inside!
        }
//		N[typeKey] = type.ToString();
        return(N);
    }
Exemplo n.º 18
0
    [System.NonSerialized] public bool usedThisFrame = false;     // a stop-gap measure to help sheep and machines not eat the same number twice in the same frame.
    public override SimpleJSON.JSONClass GetProperties()
    {
        // TODO: could have an inspector that only looks at what properties are not shared class properites
        SimpleJSON.JSONClass  N     = base.GetProperties();    //new SimpleJSON.JSONClass();
        Fraction              fr    = fraction;
        MonsterAIRevertNumber mairn = GetComponent <MonsterAIRevertNumber>();

        if (mairn.bNeedsRevert)
        {
            fr = mairn.GetOriginalFraction();
        }
        N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, fr);
        N[JsonUtil.scaleKey].AsInt = JsonUtil.GetScaleAsInt(transform);

        return(N);
    }
    public override void SetObjectProperties()
    {
//		// commented Debug.Log("numerator text is now2;"+numeratorInput.text);
//		// commented Debug.Log("ui fraction setter setting props.");
//
//		// commented Debug.Log("num, den:"+numeratorInput.text+","+denominatorInput.text);
        if (numeratorInput.text.Length == 0 ||
            denominatorInput.text.Length == 0 ||
            numeratorInput.text == "-" ||
            denominatorInput.text.Contains("-") ||
            (denominatorInput.text.Contains("0") && MathUtils.IntParse(denominatorInput.text) == 0) ||
            ((numeratorInput.text.Contains("0") && MathUtils.IntParse(numeratorInput.text) == 0)) && !allowZero)
        {
            return;
        }
//		UIRestrictInputCustom restrict = numeratorInput.GetComponent<UIRestrictInputCustom>();
//		restrict.RestrictInput(numeratorInput);
//		restrict = denominatorInput.GetComponent<UIRestrictInputCustom>();
//		restrict.RestrictInput(denominatorInput);
//		Debug.Log("numerator:"+numeratorInput.text);
        base.SetObjectProperties();
        string den = denominatorInput.text.ToString();
//		// commented Debug.Log("den;"+den);
        Fraction userInputtedFraction = new Fraction(int.Parse(numeratorInput.text.ToString()), int.Parse(den));

        SimpleJSON.JSONClass N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, userInputtedFraction);        // ConvertJsonToFraction(userInputtedFraction);
//		// commented Debug.Log("props:"+props);
        if (LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>())
        {
            LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().SetProperties(N);
        }
        else
        {
            // commented Debug.Log("tried to set frac, but no ueo!"+LevelBuilder.inst.currentPiece.name);
        }
    }
 public override SimpleJSON.JSONClass GetProperties(SimpleJSON.JSONClass N)
 {
     N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, defaultAmmo, N);
     return(N);
 }
 public override SimpleJSON.JSONClass GetProperties()
 {
     SimpleJSON.JSONClass N = base.GetProperties();
     return(JsonUtil.ConvertFractionToJson(Fraction.fractionKey, lamp.lampNumber.fraction, N));
 }
 public override SimpleJSON.JSONClass GetProperties()
 {
     SimpleJSON.JSONClass N = base.GetProperties();
     N = JsonUtil.ConvertFractionToJson(Fraction.fractionKey, spikeyChildren[0].fraction, N);
     return(N);
 }