Exemple #1
0
 private void DestroyAll()
 {
     for (int i = 0; i < UFOs.Count; i++)
     {
         UFOFactory.GetInstance().Recycle(UFOs[i]);
     }
     UFOs.Clear();
 }
Exemple #2
0
    public List <GameObject> GetUFOs()
    {
        List <GameObject> ufos = new List <GameObject>();
        var index = random.Next(3);
        var color = colors[index];
        var count = GetUFOCount();

        for (int i = 0; i < count; ++i)
        {
            Vector3 position = GetRandomPosition();
            var     obj      = UFOFactory.GetInstance().GetUFO(color);
            var     ufo      = obj.GetComponent <UFO>();
            ufo.SetPosition(position);
            ufo.score     = score[index] * (currentRound + 1);
            ufo.speed     = currentRound * 0.01f + 0.5f;
            ufo.state     = UFOState.Moving;
            ufo.direction = GetRandomDirection();
            ufos.Add(obj);
        }

        return(ufos);
    }
Exemple #3
0
 private void DestroyUFO(GameObject ufo)
 {
     UFOs.Remove(ufo);
     UFOFactory.GetInstance().Recycle(ufo);
 }
 private void OnMissUFO(GameObject ufo)
 {
     UFOs.Remove(ufo);
     UFOFactory.GetInstance().Recycle(ufo);
     model.SubScore(ruler.GetSubScore(model.currentRound));
 }
 private void OnHitUFO(GameObject ufo)
 {
     UFOs.Remove(ufo);
     UFOFactory.GetInstance().Recycle(ufo);
     model.AddScore(ufo.GetComponent <UFO>().score);
 }
Exemple #6
0
 public Ruler()
 {
     this.factory = UFOFactory.GetInstance();
     this.random  = new System.Random();
 }