public void RegistryFixedUpdate() { if (CheckRaving()) { var delta = Time.fixedDeltaTime * 2; curTime += delta; dataPiece.SetValue("top", Color.Lerp(dataPiece.GetValue <Color>("top"), newTop, delta)); dataPiece.SetValue("middle", Color.Lerp(dataPiece.GetValue <Color>("middle"), newMid, delta)); dataPiece.SetValue("bottom", Color.Lerp(dataPiece.GetValue <Color>("bottom"), newBot, delta)); SetColors(); if (curTime >= 1) { newTop = new Color(Random.value, Random.value, Random.value, Random.value); newMid = new Color(Random.value, Random.value, Random.value, Random.value); newBot = new Color(Random.value, Random.value, Random.value, Random.value); curTime = 0; } } }
protected override void Serialize(ValuedSlimeTrait <T> trait, CompoundDataPiece piece) { piece.SetValue("value", trait.Value); }
protected override void Serialize(BooleanSlimeTrait trait, CompoundDataPiece piece) { piece.SetValue <bool>(trait.Enabled); }