Example #1
0
 void OnDestroy()
 {
     // this because on Editor mode any change in sharedMaterial seems to be saved
     setBackOrigShader();
     // remove reference to anim component
     animComp = null;
 }
Example #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;
    }
Example #3
0
    //------------------------------------------------
    void OnGUI()
    {
        //Draw Atlas Object Selector
        GUILayout.Label("Atlas Generation", EditorStyles.boldLabel);
        atlasDataObject = (GameObject)EditorGUILayout.ObjectField("Atlas Object", atlasDataObject, typeof(GameObject), true);

        if (atlasDataObject == null)
        {
            return;
        }

        atlasDataComponent = atlasDataObject.GetComponent <AtlasData>();

        // if no has a valid AtlasData component then exit drawing GUI, until the game object be the correct one
        if (!atlasDataComponent)
        {
            return;
        }

        AtlasW = atlasDataComponent.AtlasTexture.width;
        AtlasH = atlasDataComponent.AtlasTexture.height;

        PopupIndex = EditorGUILayout.Popup(PopupIndex, atlasDataComponent.TextureNames);

        if (GUILayout.Button("Select Sprite From Atlas"))
        {
            // Selection works when at least one gameObject is selected in the hierarchy
            if (Selection.gameObjects.Length > 0)
            {
                foreach (GameObject Obj in Selection.gameObjects)
                {
                    // if sprite frame size is (0,0) means it is not a game object with sprite animation. Update the mesh uvs
                    if (Vector2.zero.Equals(atlasDataComponent.frameSizePixels[PopupIndex]))
                    {
                        if (Obj.GetComponent <MeshFilter>())
                        {
                            UpdateMeshUVs(Obj, atlasDataComponent.UVs[PopupIndex]);
                        }
                    }
                    // its a game object with a sprite anim. Update the animation objects accordingly
                    else
                    {
                        // get AnimateTiledTexture component to update some properties for Atlas configuration
                        AnimateTiledTexture anim = Obj.GetComponentInChildren <AnimateTiledTexture>();
                        // get all AnimateTiledConfig components to update their properties for Atlas configuration
                        AnimateTiledConfig[] configs = Obj.GetComponentsInChildren <AnimateTiledConfig>();

                        // for the AnimateTiledTexture component set the total number of rows in the atlas according to the sprite frame's height
                        //anim._rowsTotalInSprite = ;

                        // for all the AnimateTiledConfig components set the properties accordingly
                    }
                }
            }
        }
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        samples = new float[qSamples];
            spectrum = new float[qSamples];

        son = GameObject.Find("SoundLevel").GetComponent<SoundLevel>().GetSound(sound);

        //particles = gameObject.GetComponent<ParticleSystem>();
        animation = gameObject.GetComponent<AnimateTiledTexture>();
    }
 public void UnRegisterCallback(AnimateTiledTexture.VoidEvent cbFunction)
 {
     if (this._enableEvents)
     {
         this._voidEventCallbackList.Remove(cbFunction);
     }
     else
     {
         UnityEngine.Debug.LogWarning("AnimateTiledTexture: You are attempting to un-register a callback but the events of this object are not enabled!");
     }
 }
    // Use this for initialization
    void Start()
    {
        animTexture  = moveIndicator.GetComponent <AnimateTiledTexture>();
        m_PhotonView = GetComponent <PhotonView>();

        if (!m_PhotonView.isMine)
        {
            Destroy(moveIndicator);
            Destroy(this);
            return;
        }
    }
Example #7
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);
    }
Example #8
0
 void Awake()
 {
     // not required
     _animatedCrosshair = GetComponent<AnimateTiledTexture>();
 }
Example #9
0
 void Awake()
 {
     // not required
     _animatedCrosshair = GetComponent <AnimateTiledTexture>();
 }
Example #10
0
    private bool working = false;                                       // handled from the caller, not from the animate tiled object

    void Awake()
    {
        animComp = GetComponent <AnimateTiledTexture>();
    }