Esempio n. 1
0
 public void remove(DiskData disk)
 {
     disk.removeForce();
     disk.gameObject.transform.position = new Vector3(0, 0, -20f); //重新放置到摄像机后
     diskFactory.freeDisk(disk);                                   //回收
     diskList.Remove(disk);
 }
    void Update()
    {
        /**
         * free those disk already
         * fall into the ground
         */
        List <GameObject> temp = new List <GameObject> ();

        temp = alreadyEmited.FindAll(d => d.transform.position.y < 0);
        foreach (GameObject item in temp)
        {
            if (item.transform.position.y < 0)
            {
                DF.freeDisk(item);
                alreadyEmited.Remove(item);
            }
        }
    }
Esempio n. 3
0
 public void SSActionEvent(SSAction source)
 {
     if (!source.GameObject.GetComponent <DiskControl>().hit)
     {
         scoreRecorder.miss();
     }
     diskFactory.freeDisk(source.GameObject);
     source.GameObject.GetComponent <DiskControl>().hit = false;
 }
Esempio n. 4
0
 public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted,
                           int intParam = 0, string strParam = null, Object objectParam = null)
 {
     if (!source.gameobject.GetComponent <DiskData2>().hit)
     {
         scoreRecorder.miss();
     }
     diskFactory.freeDisk(source.gameobject);
 }
Esempio n. 5
0
    public void hitDisk(GameObject disk)
    {
        DiskData temp = diskFactory.getHitDisk(disk);

        if (temp != null)
        {
            GameObject obj = Object.Instantiate(Resources.Load("ParticleSystem", typeof(GameObject)), disk.transform.position, Quaternion.identity) as GameObject;
            scoreCtrl.addScore(temp.ruler.score);
            diskFactory.freeDisk(temp);
            Destroy(obj, 0.5f);
        }
    }
Esempio n. 6
0
    public void hitDisk(GameObject disk)
    {
        diskInfo temp = diskFac.getHitDisk(disk);

        if (temp == null)
        {
            Debug.Log("the disk of clicked is null? ");
        }
        else
        {
            scoreCtrl.addScore(temp.le);
            diskFac.freeDisk(temp);
        }
    }
Esempio n. 7
0
    // Update is called once per frame
    new void Update()
    {
        base.Update();
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = cam.GetComponent <Camera>().ScreenPointToRay(Input.mousePosition);
            // 获取射线
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit) && hit.collider.tag == "Disk")
            // 如果点击的物体是Disk
            {
                SceneController scene = Singleton <SceneController> .Instance;
                scene.recorder.AddScore(10); // 射中+10分

                dic.freeDisk(hit.collider.gameObject);
                // 点中,毁掉自身脚本,返回工厂
            }
        }
    }
Esempio n. 8
0
 public override void Update()
 {
     if (!this.gameObject.activeSelf) // 如果飞碟已经回收
     {
         this.destory = true;
         this.callback.SSEventAction(this, SSActionEventType.STARTED);
         return;
     }
     time += Time.deltaTime;
     transform.position += Time.deltaTime * firstDirect;
     // 各个方向的匀速运动
     transform.position += Vector3.down * g * time * Time.deltaTime;
     // 竖直方向的匀加速运动
     if (this.transform.position.y < 0)
     {
         this.destory = true;
         DiskFactory fac = Singleton <DiskFactory> .Instance;
         fac.freeDisk(gameObject);
         // 回收飞碟
         this.callback.SSEventAction(this);
     }
 }
Esempio n. 9
0
 public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted,
                           int intParam = 0, string strParam = null, UnityEngine.Object objectParam = null)
 {
     diskFactory.freeDisk(source.gameobject);
     source.gameobject.GetComponent <DiskData>().hit = false;
 }
Esempio n. 10
0
 void recycle(DiskData disk)
 {
     disk.gameObject.transform.position = new Vector3(0, 0, -100f); //重新放置到摄像机后
     diskFactory.freeDisk(disk);                                    //回收
     diskList.Remove(disk);
 }