Пример #1
0
        private void doClone(MonstorSpr m)
        {
            pausebg = true;
            if (currClone != null)
            {
                Destroy(currClone);
                Debug.Log("销毁生成的");
            }
            Debug.Log("生成clone  " + Time.time);
            GameObject go = m.go;

            if (currIndex == 0)
            {
                first = m.data;
                //GameEntry.Event.Fire(this, new ChooseMonstorEvent(first));
                this.showFirstComList();
            }
            else
            {
                second = m.data;
            }
            //音效
            GameEntry.Sound.PlaySound(1);
            //特效
            doEffect();
            currClone = Instantiate(go) as GameObject;
            currClone.transform.parent        = monsSpr.transform;
            currClone.transform.localPosition = go.transform.localPosition;
            m.SetActive(false);
        }
Пример #2
0
        public float rotateR = 300; //半径
        private void moveMons(float elapseSeconds)
        {
            if (genMonstors != null)
            {
                for (int i = 0; i < genMonstors.Count; i++)
                {
                    MonstorSpr go = genMonstors[i];
                    //if (go != null)
                    //{
                    //go.SetTransInfo(transAndPoss[go.leftTime]);
                    //}

                    //-80
                    //
                    Log.Debug(Time.fixedTime);
                    float   t   = (float)elapseSeconds / 0.03f;
                    Vector3 s   = new Vector3(0, 0, speed * t);
                    Vector3 rot = s * Time.deltaTime;
                    go.monBase.transform.Rotate(rot);

                    //Debug.Log("旋转修改");
                    //s.z += speed;
                    //go.monBase.transform.Rotate(s);

                    //GameObject go = genMonstors[i].monBase;


                    //Vector3 pos = go.transform.localPosition;
                    //if (pausebg)
                    //{
                    //genMonstors[i].w += (float)0.7 * Time.fixedDeltaTime/2 * speed; //
                    //pos.x = pos.x - 35 * Time.deltaTime;
                    //}else{
                    //pos.x = pos.x - 70 * Time.deltaTime;
                    //genMonstors[i].w += speed ;//Time.deltaTime * speed; //
                    //}
                    //float f = (-2.0f * i / cnt - 0.5f) * Mathf.PI + 2 * Mathf.PI * selectIndex / cnt;

                    //float x = Mathf.Cos(genMonstors[i].w) * rotateR + 0;
                    //float y = Mathf.Sin(genMonstors[i].w) * rotateR - 289;
                    //Debug.Log("显示 "+ x +"  "+y + " " + genMonstors[i].w + " " + r);
                    //go.transform.localPosition = new Vector3(x, y, 0);
                    //go.transform.localPosition = pos;
                    //if (pos.x < 0)
                    //{
                    //生成新物体
                    //pos
                    //}
                }
            }
        }
Пример #3
0
        //生成怪物
        public void GenerateMonstor()
        {
            int        l       = genMonstors.Count;
            MonstorSpr monData = generateSingle();

            //monData.go.gameObject.transform.localPosition = new Vector3(337, -228, 0);//new Vector3(230,-93,9);
            if (l >= maxNum)
            {
                //删除第一个
                desMon(genMonstors[0]);
                genMonstors.RemoveAt(0);
            }

            genMonstors.Add(monData);
        }
Пример #4
0
        //private int clickCount = 0;
        public void onMouseClick()
        {
            if (pausebg || m_start == false)
            {
                return;
            }
            for (int i = 0; i < genMonstors.Count; i++)
            {
                MonstorSpr m = genMonstors[i];
                if (m.IsCurrent())
                {
                    m.moveFlag = true;
                    doClone(m);

                    break;
                }
            }
        }
Пример #5
0
        protected internal override void OnOpen(object userData)
#endif
        {
            base.OnOpen(userData);
            InitConfig();
            upFlag    = true;
            lastTime  = 0;
            currIndex = 0;
            tickTime  = 0;
            curPos    = ufoMpoveImg.transform.localPosition;

            int ll = goMons.Length;

            monPool      = new MonstorSpr[ll];
            transAndPoss = new TransformAndPos[ll];
            for (int i = 0; i < ll; i++)
            {
                GameObject go = goMons[i];
                monPool[i]      = new MonstorSpr(go);
                transAndPoss[i] = new TransformAndPos(go.transform.localPosition, go.transform.localScale);
            }

            tableView.InitTableView(null, 0, updateItem);

            startBtn = Buttons.transform.Find("Start").gameObject;
            pauseBtn = Buttons.transform.Find("pause").gameObject;
            quitBtn  = Buttons.transform.Find("quit").gameObject;

            //monsSpr = this.transform.Find("monsSpr").gameObject;
            defaultMon       = new DRMonster();
            defaultMon.asset = "none";
            defaultMon.BName = "未知";

            sld.maxValue = maxHp;
            sld.value    = maxHp;
            lastHp       = curHp;

            firTrans = firstGO.transform.localPosition;
            secTrans = secondGO.transform.localPosition;
            this.showStartButton();
        }
Пример #6
0
 private void desMon(MonstorSpr tmp)
 {
     tmp.destory();
 }