Пример #1
0
        public void initDead(float posx, float posy, int x)
        {
            GameObject expObject = new GameObject();
            texplosion expl      = expObject.AddComponent <texplosion> ();
            Vector3    posv      = new Vector3(posx, posy, 0);

            expl.transform.position = posv;
            expl.init(posv, x);
        }
Пример #2
0
        public void initDead()
        {
            GameObject expObject = new GameObject();
            texplosion expl      = expObject.AddComponent <texplosion> ();
            Vector3    posv      = new Vector3(transform.position.x, transform.position.y, 0);

            expl.transform.position = posv;
            expl.init(posv, 5);
        }
Пример #3
0
 public void initHit(float posx, float posy, int x)
 {
     if (this.getHealth() >= 0)
     {
         GameObject expObject = new GameObject();
         texplosion expl      = expObject.AddComponent <texplosion> ();
         Vector3    posv      = new Vector3(posx, posy, 0);
         expl.transform.position = posv;
         expl.init(posv, x);
     }
 }
Пример #4
0
        // Use this for initialization
        public void init(texplosion owner)
        {
            //beign
            this.owner = owner;

            transform.parent        = owner.transform;                  // Set the model's parent to the gem.
            transform.localPosition = new Vector3(0, 0, 0);             // Center the model on the parent.
            //name = "Bullet Model";									// Name the object.

            mat        = GetComponent <Renderer>().material;
            mat.shader = Shader.Find("Sprites/Default");                                                // Tell the renderer that our textures have transparency. // Get the material component of this quad object.

            int type = owner.type;

            if (type == 1)
            {
                //  when a player his hit
                mat.mainTexture = Resources.Load <Texture2D> ("Textures/playerhit");
            }
            else if (type == 2)
            {
                //  when boss is hit
                mat.mainTexture      = Resources.Load <Texture2D> ("Textures/bosshit");
                transform.localScale = new Vector3(5f, 5f, 1);
            }
            else if (type == 3)
            {
                // when boss is hit by special bullet
                // yellow
                mat.mainTexture      = Resources.Load <Texture2D> ("Textures/bosshitsp");
                transform.localScale = new Vector3(5f, 5f, 1);
            }
            else if (type == 4)
            {
                // when player dies
                //reddish
                mat.mainTexture      = Resources.Load <Texture2D> ("Textures/playerdead");
                transform.localScale = new Vector3(3f, 3f, 1);
            }
            else if (type == 5)
            {
                // when boss dies
                //whitish
                mat.mainTexture      = Resources.Load <Texture2D> ("Textures/bossdead");
                transform.localScale = new Vector3(4f, 4f, 1);
            }



//		if (this.owner.name == "Bullet") {
//			mat.mainTexture = Resources.Load<Texture2D> ("Textures/playerbullet");	// Set the texture.  Must be in Resources folder.
//			//mat.color = new Color(1,1,1);
//		} else if (this.owner.name == "SpecialBullet") {
//			mat.mainTexture = Resources.Load<Texture2D> ("Textures/specialBullet");	// Set the texture.  Must be in Resources folder.
//			//mat.color = new Color(1,0,0);
//		}



            //this.transform.rotation = new Quaternion(owner.transform.rotation .x,owner.transform.rotation.y,owner.transform.rotation.z,owner.transform.rotation.w);

            //end
        }