Beispiel #1
0
 protected void DefaultDeathAnimation()
 {
     dying       = true;
     dyingLerper = new FloatLerper(GetImage().GetComponent <SpriteRenderer>().color.a, 0f, 1.0f,
                                   AbstractLerper <float> .SMOOTH_TYPE.STEP_SMOOTHER);
     dyingLerper.SetValues(GetImage().GetComponent <SpriteRenderer>().color.a, 0f, true);
 }
 void Awake()
 {
     propertyValueLerper = new FloatLerper(gameObject);
     if (propertyMaterial == null && renderer != null)
     {
         propertyMaterial = renderer.material;
     }
     D.Assert(propertyMaterial.HasProperty(propertyName), "Material {0} doesn't have property with name {1},", propertyMaterial.name, propertyName);
     D.Log("Awake: " + propertyMaterial);
 }
 private void Initialize()
 {
     //si no hay ninguna instancia
     if (instance == null)
     {
         //YO soy la instancia
         instance = this;
         //no destruyo mi gameobject para que perdure entre escenas, y asi funcione la transicion visualmente
         DontDestroyOnLoad(gameObject);
         alphaLerper = new FloatLerper(transitionTime, AbstractLerper <float> .SMOOTH_TYPE.STEP_SMOOTHER);
     }
     else
     {
         //sino me destruyo (porque otro es mi instance y no podemos tener 2)
         Destroy(gameObject);
     }
 }