Beispiel #1
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetButtonDown("Fire1"))
            {
                Debug.Log("Fired Pressed");
                Debug.Log(Input.mousePosition);

                Vector3 mp = Input.mousePosition; //get Screen Position

                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                RaycastHit hit;
                if (Physics.Raycast(ray, out hit))
                {
                    if (hit.collider.gameObject.tag.Contains("UFO"))   //plane tag
                    {
                        Debug.Log("hit " + hit.collider.gameObject.name + "!");
                    }
                    UFO ufo = hit.transform.gameObject.GetComponent <UFO>();
                    ufo.isClicked = true;
                    judgement.addScore(ufo.score);
                    UFOFactory.getInstance().recycle(hit.transform.gameObject);
                }
            }
        }
Beispiel #2
0
        public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted, int intParam = 0, string strParam = null)
        {
            Debug.Log("callback 0");
            source.destroy = false;
            this.start++;
            UFO ufo = source.gameobject.GetComponent <UFO>();

            if (!ufo.isClicked)
            {
                Judge.getInstance().subScore(ufo.score);
            }
            UFOFactory.getInstance().free(source.gameobject);
            if (this.start >= sequence.Count)
            {
                this.start = 0;
                if (repeat > 0)
                {
                    repeat--;
                }
                if (repeat == 0)
                {
                    destroy = true;
                    Debug.Log("callback 1");
                    this.callback.SSActionEvent(this);
                }
            }
        }
 void getUFO()
 {
     for (int i = 0; i < curTrialUFO; i++)
     {
         Debug.Log("fly");
         waitToFly.Add(UFOFactory.getInstance().getUFO(judgement.getRound()));
     }
     setFly();
 }
 void getUFO()
 {
     for (int i = 0; i < curTrialUFO; i++)
     {
         waitToFly.Add(UFOFactory.getInstance().getUFO(judgement.getRound()));
     }
     Debug.Log("fly");
     actionManager.FlyUFO(waitToFly, ruler, judgement.getRound());
     waitToFly.Clear();
 }
 public void recycle()
 {
     for (int i = 0; i < waitToFly.Count; i++)
     {
         UFOFactory.getInstance().free(waitToFly[i]);
     }
     for (int i = 0; i < haveFly.Count; i++)
     {
         UFOFactory.getInstance().recycle(haveFly[i]);
     }
     waitToFly.Clear();
     haveFly.Clear();
 }
Beispiel #6
0
 public void stop()
 {
     StopAllCoroutines();
     while (runSequence.Count > 0)
     {
         runSequence[0].stop();
     }
     for (int i = 0; i < waitSequence.Count; i++)
     {
         UFOFactory.getInstance().free(waitSequence[i].gameobject);
     }
     waitSequence.Clear();
 }
Beispiel #7
0
        public void SSActionEvent(SSAction source,
                                  SSActionEventType events = SSActionEventType.Competeted,
                                  int intParam             = 0,
                                  string strParam          = null)
        {
            UFO ufo = source.gameobject.GetComponent <UFO>();

            if (!ufo.isClicked)
            {
                Judge.getInstance().subScore(ufo.score);
            }
            UFOFactory.getInstance().free(source.gameobject);
        }
Beispiel #8
0
 public override void stop()
 {
     if (sequence.Count == 0)
     {
         return;
     }
     for (int i = 1; i < sequence.Count; i++)
     {
         UFOFactory.getInstance().free(sequence[i].gameobject);
     }
     for (int i = sequence.Count - 1; i >= 1; i--)
     {
         sequence.Remove(sequence[i]);
     }
     sequence[0].stop();
 }
Beispiel #9
0
        public void SSActionEvent(SSAction source,
                                  SSActionEventType events = SSActionEventType.Competeted,
                                  int intParam             = 0,
                                  string strParam          = null)
        {
            UFO ufo = source.gameobject.GetComponent <UFO>();

            if (!ufo.isClicked)
            {
                Judge.getInstance().subScore(ufo.score);
            }
            UFOFactory.getInstance().free(source.gameobject);
            runSequence.Remove(source);
            if (runSequence.Count <= 0)
            {
                if (this.callback != null)
                {
                    this.callback.SSActionEvent(source);
                }
            }
        }
 public void back()
 {
     endGame();
     UFOFactory.getInstance().clean();
     Director.getInstance().LoadScene(0);
 }