コード例 #1
0
ファイル: Action.cs プロジェクト: wywwwwei/3DGameProgramming
        // 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);
                }
            }
        }
コード例 #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);
                }
            }
        }
コード例 #3
0
 void getUFO()
 {
     for (int i = 0; i < curTrialUFO; i++)
     {
         Debug.Log("fly");
         waitToFly.Add(UFOFactory.getInstance().getUFO(judgement.getRound()));
     }
     setFly();
 }
コード例 #4
0
 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();
 }
コード例 #5
0
 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();
 }
コード例 #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();
 }
コード例 #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);
        }
コード例 #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();
 }
コード例 #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);
                }
            }
        }
コード例 #10
0
 public void back()
 {
     endGame();
     UFOFactory.getInstance().clean();
     Director.getInstance().LoadScene(0);
 }