示例#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);
            }
        }
    }
示例#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;
 }
示例#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);
 }
示例#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);
        }
    }
示例#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);
        }
    }
示例#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);
                // 点中,毁掉自身脚本,返回工厂
            }
        }
    }
示例#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);
     }
 }
示例#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;
 }
示例#10
0
 void recycle(DiskData disk)
 {
     disk.gameObject.transform.position = new Vector3(0, 0, -100f); //重新放置到摄像机后
     diskFactory.freeDisk(disk);                                    //回收
     diskList.Remove(disk);
 }