Exemplo n.º 1
0
 public static director getInstance()
 {
     if (_instance == null)
     {
         _instance = new director();
     }
     return(_instance);
 }
Exemplo n.º 2
0
        public void Start()
        {
            director = director.getInstance();
            start    = new Vector3(Random.Range(-6, 6), Random.Range(-6, 6), 0);
            if (start.x < 10 && start.x > -10)
            {
                start.x *= 5;
            }
            if (start.y < 10 && start.y > -10)
            {
                start.y *= 5;
            }
            end = new Vector3(-start.x, -start.y, 0);
            ufo.transform.position = start;
            foreach (Transform child in ufo.transform)
            {
                child.gameObject.GetComponent <MeshRenderer>().material = Material.Instantiate(Resources.Load("Prefabs/body", typeof(Material))) as Material;
            }
            int typeOfUFO = Random.Range(1, 4);

            recordType = typeOfUFO;
            switch (typeOfUFO)
            {
            case 1:
                ufo.tag = "easy";
                //ufo.GetComponent<MeshRenderer>().material =Material.Instantiate(Resources.Load("Prefabs/easy", typeof(Material))) as Material;
                ufo.GetComponent <MeshRenderer>().material.color = Color.white;
                break;

            case 2:
                ufo.tag = "middle";
                //ufo.GetComponent<MeshRenderer>().material = Material.Instantiate(Resources.Load("Prefabs/middle", typeof(Material))) as Material;
                ufo.GetComponent <MeshRenderer>().material.color = Color.gray;
                break;

            case 3:
                //ufo.tag="tough";
                //ufo.GetComponent<MeshRenderer>().material = Material.Instantiate(Resources.Load("Prefabs/tough", typeof(Material))) as Material;
                ufo.GetComponent <MeshRenderer>().material.color = Color.black;
                break;

            default:
                break;
            }
        }