纠结

using UnityEngine;
using System.Collections;

public class jiesuoBoss : MonoBehaviour {
    public GameObject nailao, bossQuan,tip,button,jinggao,tempCankao,bjHei,uibosssp5,tipfan,uibossp5f,sanjiao;
    GameObject tempuiboss5;
    public bool key,key2;
    public Vector3 tempvec3;
    public Camera uicam;
        public float fillAmount;
    public string str ;
       public UISprite us;
 public     Vector3 v2,v3;
    public  bool isone;
//    public yaojing yj;
    void Start () {
        us=bossQuan.GetComponent<UISprite>();
        fillAmount=bossQuan.GetComponent<UISprite>().fillAmount;
        tempCankao=GameObject.Find("Cube3");
    //    yj=GetComponent<yaojing>();
        bjHei.SetActive(false);
        uicam=NGUITools.FindCameraForLayer(this.gameObject.layer);
    }
    
    // Update is called once per frame
    void Update () {
    
            if(fillAmount<1&&key)
        {
            fillAmount+=Time.deltaTime*0.5f;
             us. fillAmount=fillAmount;
        }
         if(fillAmount>=1&&key)
        {
            key=false;
        //    sanjiao.transform.LookAt(v3);

            if(dataAll.tempvec3.x<=tempCankao.transform.position.x)
            {
                if(!isone)
                tip.SetActive(true);
                tempuiboss5=uibosssp5;
                    //    sanjiao.transform.localRotation=Quaternion.Euler(0f,0f,53.96f);
                //  sanjiao.transform.Rotate(0f,90f,0f);
                //        sanjiao.transform.localPosition=new Vector3(v2.x+0.13f,v2.y+0.45f,-0.2543854f);
            }
            else
            {    
                if(!isone)
                {
                    
                tipfan.SetActive(true);
                        }
        //        tempuiboss5=uibossp5f;
            //    sanjiao.transform.Rotate(0f,90f,0f);
            //        sanjiao.transform.localPosition=new Vector3(v2.x-0.15f,v2.y+0.35f,-0.2543854f);


            }
            if(!isone)
            {    
                isone=true;
                if(str!="AntPrefab3(Clone)"||str!="AntPrefab9(Clone)"||str!="AntPrefab11(Clone)"||str!="AntPrefab12(Clone)")
            //    sanjiao.SetActive(true);
            bjHei.SetActive(true);
            bjHei.GetComponent<UISprite>().alpha=0.828125f;
            button.SetActive(true);
            key2=true;            
            }
    }

    
    }

    void getBossApp()
    {    
        if(jinggao!=null)
            jinggao.SetActive(false);
        Camera.mainCamera.GetComponent<GrayscaleEffect>().enabled=true;
        tempvec3=Camera.mainCamera .WorldToScreenPoint(dataAll.tempvec3);
        tempvec3.z=0f;
        Debug.Log(tempvec3);
        v2=uicam .ScreenToWorldPoint(tempvec3);
        Debug.Log(v2);
        bossQuan.transform.localPosition=new Vector3(v2.x*75f,(v2.y+0.15f)*150f,v2.z);
        bossQuan.SetActive(true);
        //    yj.enabled=true;
        // nailao pingmuzuobiao
    //    sanjiao.transform.localPosition=v2;
    //    str="AntPrefabBoss"+dataAll.antKind+"(Clone)";
        //sanjiao.transform.LookAt(new Vector3(Screen.width*0.5f,Screen.height*0.5f,sanjiao.transform.position.z));
        key=true;

    }
}

posted @ 2014-02-25 09:55  小薇林  阅读(263)  评论(1编辑  收藏  举报