Hello. When I touch one object, all object (clones) is destroyed. How can i fix it ?
using UnityEngine;
using System.Collections;
public class DestroyObjectesEasy : MonoBehaviour
{
public static int myScore1 = 10;
public static int Highscores=0;
public static bool isDead=false;
public AudioClip shootSound;
public AudioSource source;
public float volLowRange = .5f;
public float volHighRange = 1.0f;
public void awake()
{
source = GetComponent<AudioSource>();
}
/* void OnMouseDown()
{
isDead = true;
Destroy (this.gameObject);
StartSinking ();
}*/
void Update() {
if (Input.touchCount > 0)
{
int i = 0;
for (i = 0; i < Input.touchCount; i++)
{
Destroy(this.gameObject);
}
//Do something with the touches
isDead = true;
//Destroy (this.gameObject);
Scoring ();
//if (Input.GetButtonDown ("Fire1")) {
float vol = Random.Range (volLowRange, volHighRange);
if (isDead == true)
source.PlayOneShot (shootSound);
isDead = false;
}
}
public void Scoring () {
ScoreManagerEasy.score1 += myScore1;
}
}