Skip to content

Commit

Permalink
an other test for serialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed May 15, 2014
1 parent 11632e6 commit e40e686
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 24 deletions.
5 changes: 5 additions & 0 deletions ModelMultiParticlePersistFX.cs
Expand Up @@ -653,6 +653,8 @@ public void Update()
public override void OnInitialize()
{
print("OnInitialize");
print("OnInitialize" + emission.name);
print("OnInitialize" + emission.curves[0].valueName);

// The shader loading require proper testing
// Unity doc says that "Creating materials this way supports only simple shaders (fixed function ones).
Expand Down Expand Up @@ -766,6 +768,9 @@ public override void OnLoad(ConfigNode node)

angle.Load("angle", node);
distance.Load("distance", node);

print("OnLoad3" + emission.name);
print("OnLoad3" + emission.curves[0].valueName);
}

public override void OnSave(ConfigNode node)
Expand Down
88 changes: 64 additions & 24 deletions MultiInputCurve.cs
Expand Up @@ -6,40 +6,80 @@

using UnityEngine;


[Serializable]
public class MultiInputCurve
public class FXCurves
{
public string name;
private FXCurve[] _curves = new FXCurve[inputsCount];
public FXCurve[] curves
[SerializeField]
private FXCurve power;
[SerializeField]
private FXCurve density;
[SerializeField]
private FXCurve mach;
[SerializeField]
private FXCurve parttemp;
[SerializeField]
private FXCurve externaltemp;

public FXCurve this[int i]
{
get { return _curves; }
set { _curves = value; }
get
{
switch (i)
{
case (int)MultiInputCurve.Inputs.power:
return power;
case (int)MultiInputCurve.Inputs.density:
return density;
case (int)MultiInputCurve.Inputs.mach:
return mach;
case (int)MultiInputCurve.Inputs.parttemp:
return parttemp;
case (int)MultiInputCurve.Inputs.externaltemp:
return externaltemp;
default:
return power;
}
}
set
{
switch (i)
{
case (int)MultiInputCurve.Inputs.power:
power = value;
break;
case (int)MultiInputCurve.Inputs.density:
density = value;
break;
case (int)MultiInputCurve.Inputs.mach:
mach = value;
break;
case (int)MultiInputCurve.Inputs.parttemp:
parttemp = value;
break;
case (int)MultiInputCurve.Inputs.externaltemp:
externaltemp = value;
break;
}
}
}
}

private FXCurve[] _logCurves = new FXCurve[inputsCount];
public FXCurve[] logCurves
{
get { return _logCurves; }
set { _logCurves = value; }
}

private float[] _minKey = new float[inputsCount];
public float[] minKey
{
get { return _minKey; }
set { _minKey = value; }
}
private float[] _maxKey = new float[inputsCount];
public float[] maxKey
{
get { return _maxKey; }
set { _maxKey = value; }
}
[Serializable]
public class MultiInputCurve
{
public string name;
public FXCurves curves = new FXCurves();
public FXCurves logCurves = new FXCurves();

public float[] minKey = new float[inputsCount];
public float[] maxKey = new float[inputsCount];

public float minVal;
public float maxVal;

[SerializeField]
bool additive;

public enum Inputs
Expand Down

0 comments on commit e40e686

Please sign in to comment.