Ejemplo n.º 1
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         throw new UnityException("ElementSpawn.Instance!=null");
     }
 }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        spawnArea = GameObject.FindGameObjectWithTag("SpawnArea").GetComponent <ElementSpawn>();
        spawnArea.elementReference.Add(this.gameObject);
        if (elementType == ElementEnum.Elements.None)
        {
            RandomType();
        }

        rnd       = new System.Random(Guid.NewGuid().GetHashCode());
        angles[0] = (float)rnd.NextDouble();
        angles[1] = (float)rnd.NextDouble();
        angles[2] = (float)rnd.NextDouble();

        rotationSpeed = 90;
        speed         = 2f;
        source        = GetComponent <AudioSource>();
    }