void Start() { anim = enemy.GetComponent <Animator>(); dtp = GetComponent <DOTweenPath>(); dtp.relative = true; originalPos = transform.position; oriForward = transform.forward; hitInfo = new Dictionary <float, string>(); effectInfo = new Dictionary <float, GameObject>(); newPathPosition = new List <Vector3>(); oriPathPosition = new List <Vector3>(); if (dtp.wps != null) { for (int i = 0; i < dtp.wps.Count; i++) { oriPathPosition.Add(dtp.wps[i] - originalPos); } } for (int i = 0; i < ei.Length; i++) { effectInfo.Add(ei[i].time, ei[i].go); } for (int i = 0; i < hi.Length; i++) { hitInfo.Add(hi[i].time, hi[i].name); } }
public override void OnCreate() { mRoleName = GetChild <Text>("RoleInfo/Text"); mGold = GetChild <Text>("Gold/Text"); mDiamond = GetChild <Text>("Diamond/Text"); mRoleName.text = OwnerData.Instance.Name; mGold.text = OwnerData.Instance.Gold.ToString(); mDiamond.text = OwnerData.Instance.Diamond.ToString(); mGoldButton = GetChild <Button>("Gold/Button"); mDiamondButton = GetChild <Button>("Diamond/Button"); mGoldButton.onClick.AddListener(OnGoldButtonClick); mDiamondButton.onClick.AddListener(OnDiamondButtonClick); mRoleExp = GetChild <Slider>("RoleInfo/Slider"); mRoleExp.value = GetExpRatio(); InitFlightInfo(); UpdateAirportInfo(); mPath = GetChild <DOTweenPath>("Path"); DispatchMgr.Instance.RegisterEvent(Define.DISPATCHEVENT.DISPATCHEVENT_ADDFLIGHT, AddFlight); DispatchMgr.Instance.RegisterEvent(Define.DISPATCHEVENT.DISPATCHEVENT_REMOVEFLIGHT, RemoveFlight); }
void Start() { newPathPositions = new List <Vector3>(); oriPathPositions = new List <Vector3>(); if (gameObject.name == "PlayerAnimationData" || gameObject.name.EndsWith("(Clone)")) { return; } if (sword && rapier && mace && axe && bow) { sword.SetActive(false); rapier.SetActive(false); mace.SetActive(false); axe.SetActive(false); bow.SetActive(false); } anim = moveTransform.GetComponent <Animator>(); myTime = totalTime; dtp = GetComponent <DOTweenPath>(); dtp.relative = true; originalPos = transform.position; oriForward = transform.forward; if (dtp.wps != null && dtp.wps.Count > 0) { for (int i = 0; i < dtp.wps.Count; i++) { oriPathPositions.Add(dtp.wps[i] - originalPos); } } }
private void OnEnable() { //Debug.LogError ("*******************OnEnable************************"); try { this._src = base.target as DOTweenPath; } catch (Exception ex) { ex.ToString(); return; } this.StoreSceneCamData(); if (this._src.path == null) { this.ResetPath(RepaintMode.None); } base.onStartProperty = base.serializedObject.FindProperty("onStart"); base.onPlayProperty = base.serializedObject.FindProperty("onPlay"); base.onUpdateProperty = base.serializedObject.FindProperty("onUpdate"); base.onStepCompleteProperty = base.serializedObject.FindProperty("onStepComplete"); base.onCompleteProperty = base.serializedObject.FindProperty("onComplete"); base.onTweenCreatedProperty = base.serializedObject.FindProperty("onTweenCreated"); this._refreshAfterEnable = true; }
//生成气泡,并创建动画,触发动画播放完成事件 public void CreateBubble() { if (this.bubblePrefab != null) { //后面有bug。此处强制设置位置索引 if (this.material == Material.XY || this.material == Material.XYL) { this.materialPanelIndex = 0; } GameObject bubble = Instantiate(this.bubblePrefab, this.transform) as GameObject; bubble.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; dotweenPathABS = bubble.GetComponent <DOTweenPath>() as ABSAnimationComponent; this.dotweenPathABS.onComplete.AddListener( () => { DOTweenPath dotweenPath = bubble.GetComponent <DOTweenPath>(); Vector2 endPos = new Vector2(materialPanelIndex * 123 + -397, -25); if (this.materialObj == null) { this.materialObj = CreateMaterial(materialStartPos, endPos, false); } else { CreateMaterial(materialStartPos, endPos, true); } Destroy(bubble); }); } }
//生成气泡,并创建动画,触发动画播放完成事件 public void CreateBubble() { if (this.bubblePrefab != null) { if (this.countDown.enabled == false) { this.countDown.enabled = true; } GameObject bubble = Instantiate(this.bubblePrefab, this.transform) as GameObject; bubble.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; dotweenPathABS = bubble.GetComponent <DOTweenPath>() as ABSAnimationComponent; this.dotweenPathABS.onComplete.AddListener( () => { DOTweenPath dotweenPath = bubble.GetComponent <DOTweenPath>(); Vector2 endPos = new Vector2(materialPanelIndex * 123 + -397, -25); if (this.materialObj == null) { //this.materialObj = CreateMaterial(materialStartPos, endPos, false); this.materialObj = CreateMaterial(new Vector2(190, -332), endPos, false); } else { //CreateMaterial(materialStartPos, endPos, true); CreateMaterial(new Vector2(190, -332), endPos, true); } Destroy(bubble); }); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer == LayerMask.NameToLayer("Player")) { rb.useGravity = true; if (isLethal) { Debug.Log("Game Over"); collision.gameObject.GetComponent <PlayerHandler>().Die(); } } else if (collision.gameObject.layer == LayerMask.NameToLayer("Obstacle")) { if (isMoving || isRotating) { isMoving = false; isRotating = false; DOTween.Kill(transform); DOTweenAnimation anim = GetComponent <DOTweenAnimation>(); if (anim != null) { Destroy(anim); } DOTweenPath path = GetComponent <DOTweenPath>(); if (path != null) { Destroy(path); } } rb.useGravity = true; } }
private float Timer; // 纪录时间 private void Awake() { DoPlayerPath = GetComponent <DOTweenPath>(); DoCar1Path = Car1.GetComponent <DOTweenPath>(); DoCar2Path = Car2.GetComponent <DOTweenPath>(); DoCar3Path = Car3.GetComponent <DOTweenPath>(); }
public int GetCurrentStep(DOTweenPath path) { if (currentStep.ContainsKey(path)) { return(currentStep[path]); } return(0); }
public Ease GetEaseType() { if (!_tweenPath) { _tweenPath = GetComponent <DOTweenPath>(); } return(_tweenPath.easeType); }
private IEnumerator Start() { _dotWeenPath = GetComponent <DOTweenPath>(); yield return(new WaitForSeconds(1f)); _dotWeenPath.DORestart(); }
// Start is called before the first frame update void Awake() { anim = GetComponent <Animator>(); path = GetComponent <DOTweenPath>(); //path.duration = speed; state = FishState.move; //path.loopType = LoopType.Incremental; //path.loops = -1; }
void Start() { myPath = GetComponent <DOTweenPath>(); isSlowedLV1 = false; isSlowedLV2 = false; isSlowedLV3 = false; slowedLevel = 0; coroutineActivated = false; }
public float GetSpeed() { if (!_tweenPath) { _tweenPath = GetComponent <DOTweenPath>(); } return(_tweenPath.duration); }
// Start is called before the first frame update void Start() { rb = gameObject.GetComponent <Rigidbody>(); dott = gameObject.GetComponent <DOTweenPath>(); if (Random.Range(0, 3) == 0) { yesturnpls = true; } }
public LoopType GetLoopType() { if (!_tweenPath) { _tweenPath = GetComponent <DOTweenPath>(); } return(_tweenPath.loopType); }
public List <Vector3> ListPath() { if (!_tweenPath) { _tweenPath = GetComponent <DOTweenPath>(); } return(_tweenPath.wps); }
void Awake() { if (instance == null) { instance = this; path = GetComponent <DOTweenPath> (); } }
/// <summary> /// 移除事件 /// </summary> /// <param name="doTweenPath">doTweenPath 路径</param> /// <param name="index">目标位置</param> public void RemoveEvent(DOTweenPath doTweenPath, int index) { if (index >= 0 && index < doTweenPath.wps.Count) { if (tweenPathEventHandle.ContainsKey(doTweenPath)) { tweenPathEventHandle[doTweenPath].pathEventData[index] = new PathEventData(); } } }
void OnEnable() { //i like bold handle labels since I'm getting old: style.fontStyle = FontStyle.Bold; style.normal.textColor = Color.white; _target = (DOTweenPath)target; if (_target.nodes == null) { _target.nodes = new List <Vector3>(); } }
/// <summary> /// 移除路径 /// </summary> /// <param name="tweenPath">doTweenPath 路径</param> public void RemovePath(DOTweenPath tweenPath) { if (tweenPathEventHandle.ContainsKey(tweenPath)) { tweenPath.tween.OnWaypointChange(null); tweenPathEventHandle.Remove(tweenPath); if (currentStep.ContainsKey(tweenPath)) { currentStep.Remove(tweenPath); } } }
public DOTweenPath GetPathTween() { if (go != null) { if (pathTween == null) { pathTween = go.GetComponent <DOTweenPath>(); } return(pathTween); } return(null); }
/// <summary> /// 检测目标点事件if /// </summary> /// <param name="tweenPath"></param> /// <param name="index"></param> private void CheckPoint(DOTweenPath tweenPath, int index) { if (tweenPathEventHandle.ContainsKey(tweenPath)) { currentStep[tweenPath] = index; Dictionary <int, PathEventData> e = tweenPathEventHandle[tweenPath].pathEventData; if (e.ContainsKey(index)) { e[index].Action(); } } }
protected override void Start() { base.Start(); m_BeamClone = Instantiate(m_BeamPrefab, m_Emitter.transform.position, m_Emitter.transform.rotation); m_BeamClone.Init(m_Emitter, m_MaxAttackDistance); m_ArrayPathForwardTween = m_ArrayPathForward.gameObject.GetComponent <DOTweenPath>(); m_ArrayPathReverseTween = m_ArrayPathReverse.gameObject.GetComponent <DOTweenPath>(); m_ArrayPathForward.m_PrimaryArray = true; // So only one array updates Emitter Location SetEmitterChargePathsStatus(false); }
public void Awake() { _img = GetComponent <Image>(); _movePathAnim = GetComponent <DOTweenPath>(); _defaultPos = transform.localPosition; _movePathAnim.onComplete.AddListener(OnAnimEnd); void OnAnimEnd() { transform.localPosition = _defaultPos; gameObject.SetActive(false); } }
// 测试说明:DOPath是世界坐标系 // DOLocalPath是相对坐标系 // 特别说明: path.isLocal 的值不管是什么都没什么影响 void SetTargetMove() { DOTweenPath path = transform.GetComponent <DOTweenPath>(); path.duration = 5; path.easeType = Ease.Linear; path.pathType = PathType.CatmullRom; path.isLocal = true; TweenerCore <Vector3, Path, PathOptions> tweenerCore = transform.DOPath(waypoints, path.duration); //TweenerCore<Vector3, Path, PathOptions> tweenerCore = transform.DOLocalPath(waypoints, path.duration); transform.DOPlay(); }
void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hitInfo; target = ReturnClickedObject(out hitInfo); if (target != null && target.transform.tag == "command") { _isMouseDrag = true; target.GetComponent <DOTweenPath>().DOPause(); pickupPosition = target.transform.position; screenPosition = Camera.main.WorldToScreenPoint(target.transform.position); offset = target.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPosition.z)); } } if (Input.GetMouseButtonUp(0) && target.tag == "command") { DOTweenPath path = target.GetComponent <DOTweenPath>(); _isMouseDrag = false; //if (droppedInLine()) //{ //target.GetComponent<CommandObj>().setInLine(true); //target.transform.parent = ObjInLine.transform.parent; //target.transform.position = cmdSpawn.transform.position; //path.DORestart(true); Destroy(target.gameObject); GameControlBehaviour.instance.StartCoroutine("createCommands", 1); //} //else //{ // target.transform.position = pickupPosition; //} //path.DOPlay(); } if (_isMouseDrag) { //track mouse position. Vector3 currentScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPosition.z); //convert screen position to world position with offset changes. Vector3 currentPosition = Camera.main.ScreenToWorldPoint(currentScreenSpace) + offset; //It will update target gameobject's current postion. target.transform.position = currentPosition; } }
/// <summary> /// Create start data for platform like path, start position, type path move... /// </summary> /// <param name="obj"></param> public void Init(PlatformObj obj) { Trans.position = obj.Position; if (!_tweenPath) { _tweenPath = GetComponent <DOTweenPath>(); } if (obj.Path != null && obj.Path.Count > 0) { Trans.DOPath(obj.Path.ToArray(), 5, PathType.Linear, PathMode.TopDown2D) .SetSpeedBased().SetLoops(-1, obj.LoopType).SetUpdate(UpdateType.Fixed) .SetEase(obj.EaseType); } }
private void OnEnable() { this._src = (base.target as DOTweenPath); this.StoreSceneCamData(); if (this._src.path == null) { this.ResetPath(RepaintMode.None); } base.onStartProperty = base.serializedObject.FindProperty("onStart"); base.onPlayProperty = base.serializedObject.FindProperty("onPlay"); base.onUpdateProperty = base.serializedObject.FindProperty("onUpdate"); base.onStepCompleteProperty = base.serializedObject.FindProperty("onStepComplete"); base.onCompleteProperty = base.serializedObject.FindProperty("onComplete"); base.onTweenCreatedProperty = base.serializedObject.FindProperty("onTweenCreated"); this._refreshAfterEnable = true; }
/// <summary> /// 添加事件 /// </summary> /// <param name="doTweenPath">doTweenPath 路径</param> /// <param name="index">目标位置</param> /// <param name="action">回调函数</param> public void AddEvent(DOTweenPath doTweenPath, int index, UnityAction action) { if (!tweenPathEventHandle.ContainsKey(doTweenPath)) { doTweenPath.tween.OnWaypointChange((pointIndex) => { CheckPoint(doTweenPath, pointIndex); }); tweenPathEventHandle.Add(doTweenPath, new TweenPathEvent()); } if (!tweenPathEventHandle[doTweenPath].pathEventData.ContainsKey(index)) { tweenPathEventHandle[doTweenPath].pathEventData[index] = new PathEventData(); } tweenPathEventHandle[doTweenPath].pathEventData[index].pathEvent += action; }