示例#1
0
 // Use this for initialization
 void Start()
 {
     Cursor.visible = false;
     anim           = GameObject.Find("swordWithAnim").GetComponent <Animator>();
     moveSkript     = GetComponent <fpsMove> ();
     targetBox      = transform.FindChild("TargetBox").gameObject;
     floatingSkript = lockOnImage.GetComponent <FloatingTag> ();
 }
示例#2
0
        public static Transform InitFloatingPanel(Transform rootTran, List <Transform> imageTran)
        {
            Transform canvasRoot = GameObject.Find("TagCanvas").transform;
            //			Transform tagCanvas = Instantiate (Resources.Load ("Prefabs/TagCanvas") as GameObject, rootTran).transform;
            //			tagCanvas.parent = rootTran;
            //			tagCanvas.localScale = Vector3.one;
            //			Transform canvasRoot = tagCanvas.Find ("Tags").transform;
            Transform tagRoot = new GameObject(rootTran.name + "_root").transform;

            tagRoot.parent     = canvasRoot;
            tagRoot.localScale = Vector3.one;
            //			tagRoot.localEulerAngles = Vector3.zero;
            tagRoot.localRotation = Quaternion.identity;
            var tags = new List <FloatingTag>();

            for (int i = 0; i < imageTran.Count; i++)
            {
                FloatingTag tag = Instantiate(((GameObject)Resources.Load("Prefabs/Tag")).GetComponent <FloatingTag>(), tagRoot);
                tag.Init(imageTran[i]);
                tags.Add(tag);
            }
            return(tagRoot);
        }