Beispiel #1
0
 private void setBackOrigShader()
 {
     if (animComp != null)
     {
         animComp.GetComponent <Renderer>().sharedMaterial.shader = origShader;
     }
 }
Beispiel #2
0
    void Start()
    {
        // get original CP shape layer so when falling in empty space and die we can later restore to original state
        layersCP = gameObject.GetComponent <ChipmunkShape>().layers;

        // get original render queue
        animComp   = GetComponentInChildren <AnimateTiledTexture>();
        origShader = animComp.GetComponent <Renderer>().sharedMaterial.shader;
    }
Beispiel #3
0
    public void startAnimation()
    {
#if UNITY_EDITOR
        wasDying = true;
#endif
        dying = true;

        // change CP shape's current layer so it doesn't collide with any other shape
        layersCP = gameObject.GetComponent <ChipmunkShape>().layers;
        GameObjectTools.setLayerForShapes(gameObject, 0);

        // set special shader which will render this game object in front of all layers
        animComp = GetComponentInChildren <AnimateTiledTexture>();
        animComp.GetComponent <Renderer>().sharedMaterial.shader = shaderForDie;

        // execute a little jump as dying animation
        GetComponent <ChipmunkShape>().body.velocity = Vector2.zero;
        jump.forceJump(GetComponent <Player>().lightJumpVelocity);
    }