private GameObject FindPresetLocation(EnumList.PresetType type) { GameObject obj = null; GameObject[] targetlist = GameObject.FindGameObjectsWithTag("PresetCameraLocation"); for (int i = 0; i < targetlist.Length; i++) { if (targetlist[i].GetComponent <PresetCameraLocation>().presetType == type) { obj = targetlist[i]; break; } } return(obj); }
/// <summary> /// using iTween to move the camera /// </summary> /// <param name="type"></param> public void MoveTo(EnumList.PresetType type) { GameObject target = FindPresetLocation(type); if (!target) { return; } iTween.MoveTo(this.gameObject, iTween.Hash("position", target.transform, "time", 3, "onstart", "OnMovementStart", "oncomplete", "OnMovementComplete" )); iTween.RotateTo(this.gameObject, iTween.Hash("rotation", target.transform, "islocal", false, "time", 3, "onstart", "OnRotationStart", "oncomplete", "OnRotationComplete" )); }