private IEnumerator IECreateMonster() { foreach (MonsterPattenrItem item in MonsterPetternList) { if (item.MonsterObj != null) { for (int count = 0; count < item.SlotCount; count++) { GameObject Monster = GameObject.Instantiate(item.MonsterObj, StartPosition.position, Quaternion.identity) as GameObject; iTweenEvent tweenEvent = Monster.AddComponent <iTweenEvent>(); tweenEvent.Values = MonsterPathEvent.Values; yield return(new WaitForSeconds(MonsterCreateGap)); } } } // MonsterPos = monster.transform; // MonsterstartPos = new Vector3(-60, 0, 35); // // for (int i = 0; i <= MonsterCount; i++) // { // GameObject obj; // obj = Instantiate(monster, MonsterstartPos, Quaternion.identity) as GameObject; // obj.SetActive(true); // monsterList.Add(obj); // yield return new WaitForSeconds(2.0f); // } // yield return new WaitForSeconds(MonsterCreateGap); }
private void Awake() { if (actor == null) { actor = transform; } actorTween = actor.gameObject.GetComponent <iTweenEvent> (); if (actorTween == null) { actorTween = actor.gameObject.AddComponent <iTweenEvent> (); } //these can be set in Unity editor actorTween.type = iTweenEvent.TweenType.MoveTo; actorTween.Values["position"] = actor; actorTween.Values["speed"] = actorSpeed; actorTween.Values["movetopath"] = false; actorTween.Values["orienttopath"] = true; actorTween.Values["easetype"] = iTween.EaseType.linear; actorTween.Values["oncomplete"] = nextPathMethod.ToString(); actorTween.Values["oncompletetarget"] = gameObject; //square distance for faster calculations nextPathDistance *= nextPathDistance; }
public void OnEnable() { //i like bold handle labels since I'm getting old: style.fontStyle = FontStyle.Bold; style.normal.textColor = Color.white; _target = (iTweenEvent)target; //lock in a default path name: if (!_target.initialized) { _target.initialized = true; _target.pathName = "New Path " + ++count; _target.initialName = _target.pathName; } var evt = (iTweenEvent)target; foreach (var key in EventParamMappings.mappings[evt.type].Keys) { propertiesEnabled[key] = false; } previousType = evt.type; if (!Directory.Exists(Application.dataPath + "/Gizmos")) { Directory.CreateDirectory(Application.dataPath + "/Gizmos"); } if (!File.Exists(Application.dataPath + "/Gizmos/iTweenIcon.tif")) { FileUtil.CopyFileOrDirectory(Application.dataPath + "/iTweenEditor/Gizmos/iTweenIcon.tif", Application.dataPath + "/Gizmos/iTweenIcon.tif"); } }
private void Awake() { if (actor == null) { actor = transform; } actorTween = actor.gameObject.GetComponent<iTweenEvent> (); if (actorTween == null) { actorTween = actor.gameObject.AddComponent<iTweenEvent> (); } //these can be set in Unity editor actorTween.type = iTweenEvent.TweenType.MoveTo; actorTween.Values["position"] = actor; actorTween.Values["speed"] = actorSpeed; actorTween.Values["movetopath"] = false; actorTween.Values["orienttopath"] = true; actorTween.Values["easetype"] = iTween.EaseType.linear; actorTween.Values["oncomplete"] = nextPathMethod.ToString (); actorTween.Values["oncompletetarget"] = gameObject; //square distance for faster calculations nextPathDistance *= nextPathDistance; }
public void Init () { idleId = name.Replace ("Idle_", ""); idleId = idleId.Replace ("(Clone)", ""); mJumpEvent = iTweenEvent.GetEvent (gameObject, "JumpEvent"); mIdleEvent = iTweenEvent.GetEvent (gameObject, "IdleEvent"); mScaleEvent = iTweenEvent.GetEvent (sprite.gameObject, "ScaleEvent"); characterTransform.localScale = new Vector3 (0.8f, 0.8f, 0.8f); StartMoving (); }
void tweenstart() { iTweenEvent it = (iTweenEvent)gameObject.GetComponent <iTweenEvent>(); foreach (iTweenPath itp in it.paths) { Debug.Log(itp.pathName); } Debug.Log("tween tweenstart!!"); }
public static iTweenEvent GetEvent(GameObject obj, string name) { iTweenEvent[] components = obj.GetComponents <iTweenEvent>(); if (components.Length > 0) { iTweenEvent iTweenEvent = components.FirstOrDefault((iTweenEvent tween) => tween.tweenName == name); if (iTweenEvent != null) { return(iTweenEvent); } } throw new ArgumentException("No tween with the name '" + name + "' could be found on the GameObject named '" + obj.name + "'"); }
void OnSpawned() { if (tk2dText == null) { tk2dText = GetComponent <tk2dTextMesh>(); } if (tweenEvent == null) { tweenEvent = GetComponent <iTweenEvent>(); } tweenEvent.Play(); Invoke("Despawn", lifetime); }
public static iTweenEvent GetEvent(GameObject obj, string name) { iTweenEvent[] components = obj.GetComponents <iTweenEvent>(); if (components.Length > 0) { iTweenEvent iTweenEvent = Enumerable.FirstOrDefault <iTweenEvent>(components, (iTweenEvent tween) => tween.tweenName == name); if (iTweenEvent != null) { return(iTweenEvent); } } throw new ArgumentException(string.Concat(new string[] { "No tween with the name '", name, "' could be found on the GameObject named '", obj.get_name(), "'" })); }
void tweenfinish() { iTweenEvent it = (iTweenEvent)gameObject.GetComponent <iTweenEvent>(); foreach (iTweenPath itp in it.paths) { Debug.Log(itp.pathName); } //跑完換路徑. if (it.Values.ContainsKey("path")) { if (it.Values["path"].GetType() == typeof(string)) { it.Values["path"] = "New Path 1"; } } it.Play(); Debug.Log("tween finish!!"); }
public void Init () { mRotateEvent = iTweenEvent.GetEvent (sprite.gameObject, "RotateEvent"); mJumpEvent = iTweenEvent.GetEvent (gameObject, "JumpEvent"); StartMoving (); }
void MoveCameraByZiYouYiDongPath() { if (CartoonShootPathScript.iTweenEventIndex != -1) { ITweenEventArray[CartoonShootPathScript.iTweenEventIndex].enabled = true; } else { if (CartoonShootPathScript.IsMoveByPathSpeed) { iTweenEvent itweenScript = CartoonShootPathScript.ITweenEventCom; if (itweenScript != null) { itweenScript.enabled = true; } else { if (ZiYouYiDongCamPtahTran.childCount <= 1) { return; } List <Transform> nodes = new List <Transform>(ZiYouYiDongCamPtahTran.GetComponentsInChildren <Transform>()) { }; nodes.Remove(ZiYouYiDongCamPtahTran); if (CartoonShootPathScript.IsAimObj) { iTween.MoveTo(CameraObj, iTween.Hash("path", nodes.ToArray(), "speed", CartoonShootPathScript.MoveSpeed, "looktarget", CartoonShootPathScript.AimTran, "looktime", CartoonShootPathScript.LookTime, "easeType", iTween.EaseType.linear, "oncomplete", "OnFinishMoveCameraByZiYouYiDongPath")); } else { iTween.MoveTo(CameraObj, iTween.Hash("path", nodes.ToArray(), "speed", CartoonShootPathScript.MoveSpeed, "orienttopath", true, "easeType", iTween.EaseType.linear, "oncomplete", "OnFinishMoveCameraByZiYouYiDongPath")); } } } else { Transform tran_0 = ZiYouYiDongCamPtahTran.GetChild(MarkCurrentIndex); Transform tran_1 = ZiYouYiDongCamPtahTran.GetChild(MarkCurrentIndex + 1); CartoonShootMark mark = tran_0.GetComponent <CartoonShootMark>(); Transform[] path = new Transform[2]; tran_0.position = MainCamTran.position; tran_0.rotation = MainCamTran.rotation; path[0] = tran_0; path[1] = tran_1; if (CartoonShootPathScript.IsAimObj) { iTween.MoveTo(CameraObj, iTween.Hash("path", path, "speed", mark.MoveSpeed, "looktarget", CartoonShootPathScript.AimTran, "looktime", CartoonShootPathScript.LookTime, "easeType", iTween.EaseType.linear, "oncomplete", "OnFinishMoveCameraByZiYouYiDongPath")); } else { iTween.LookTo(CameraObj, iTween.Hash("path", path, "looktarget", tran_1, "time", mark.LookTime, "easeType", iTween.EaseType.linear, "oncomplete", "OnFinishMoveCameraByRotation")); } } } }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); setscr = GetComponent <iTweenEvent> (); }
// private bool m_hasplay = false; void OnTriggerEnter(Collider other) { if (other.tag == "finish") { m_PlayerAnimator.speed = 3.8f / Time.timeScale; // m_IsFinished = true; m_PlayerAnimator.SetBool("IsFinish", true); m_PlayerAnimator.SetBool("IsRoot", false); } if (other.tag == "zhangai") { m_PlayerAnimator.SetTrigger("IsZhuang"); m_CameraShake.setCameraShakeImpulseValue(); m_HitStone.Play(); GameObject temp = (GameObject)Instantiate(m_HitEffectObj, transform.position, transform.rotation); Destroy(temp, 2.0f); } if (other.tag == "texiao0") { m_PlayerAnimator.SetTrigger("IsQifei"); m_FeibanAudio.Play(); // m_TeXiao0Audio.Play(); GameObject temp = (GameObject)Instantiate(m_TeXiao0Audio, transform.position, transform.rotation); Destroy(temp, 3.0f); } if (other.tag == "texiao1") { m_PlayerAnimator.SetTrigger("IsDiaoluo"); m_FeibanAudio.Play(); // m_TeXiao1Audio.Play(); GameObject temp = (GameObject)Instantiate(m_TeXiao1Audio, transform.position, transform.rotation); Destroy(temp, 3.0f); } if (other.tag == "texiao2") { //Debug.Log("IsZuantoufjkfjfkl"); m_PlayerAnimator.SetTrigger("IsZuantou"); if (!m_Isdapubu) { m_FeibanAudio.Play(); GameObject temp = (GameObject)Instantiate(m_TeXiao2Audio, transform.position, transform.rotation); Destroy(temp, 4.2f); } else { m_Isdapubu = false; } } if (other.tag == "texiao3") { m_PlayerAnimator.SetTrigger("IsTaitou"); m_FeibanAudio.Play(); // m_TeXiao3Audio.Play(); GameObject temp = (GameObject)Instantiate(m_TeXiao3Audio, transform.position, transform.rotation); Destroy(temp, 3.0f); } if (other.tag == "texiao4") { m_PlayerAnimator.SetTrigger("IsDianshan"); m_FeibanAudio.Play(); // m_TeXiao4Audio.Play(); GameObject temp = (GameObject)Instantiate(m_TeXiao4Audio, transform.position, transform.rotation); Destroy(temp, 4.2f); } if (other.tag == "texiao5") { m_Isdapubu = true; m_PlayerAnimator.SetTrigger("IsTaitou"); m_FeibanAudio.Play(); GameObject temp = (GameObject)Instantiate(m_FeibanEffectObj, transform.position, transform.rotation); Destroy(temp, 2.0f); } if (other.tag == "texiaoyin") { // m_Isdapubu = true; // m_PlayerAnimator.SetTrigger("IsTaitou"); m_FeibanAudio.Play(); } if (other.tag == "left") { m_PlayerAnimator.SetBool("IsTurnleft", true); m_PlayerAnimator.SetBool("IsTurnRight", false); m_PlayerAnimator.SetBool("IsRoot", false); m_PlayerAnimator.speed = 1.0f / Time.timeScale; //Debug.Log("m_PlayerAnimator.speed" + m_PlayerAnimator.speed); } if (other.tag == "right") { m_PlayerAnimator.SetBool("IsTurnRight", true); m_PlayerAnimator.SetBool("IsTurnleft", false); m_PlayerAnimator.SetBool("IsRoot", false); m_PlayerAnimator.speed = 1.0f / Time.timeScale; //Debug.Log("m_PlayerAnimator.speed" + m_PlayerAnimator.speed); } if (other.tag == "root") { //m_PlayerAnimator.speed = 1.0f/Time.timeScale; m_PlayerAnimator.SetBool("IsDianshan1", false); m_PlayerAnimator.SetBool("IsRoot", true); m_PlayerAnimator.SetBool("IsTurnRight", false); m_PlayerAnimator.SetBool("IsTurnleft", false); } if (other.tag == "hitwater") { m_CameraShake.setCameraShakeImpulseValue(); m_HitWater.Play(); GameObject Tobject = (GameObject)Instantiate(m_HitWaterParticle, transform.position + transform.forward * m_BaozhaForward + Vector3.up * m_BaozhaUp, transform.rotation); Destroy(Tobject, 0.5f); } if (other.tag == "hitwater0") { // m_CameraShake.setCameraShakeImpulseValue(); m_HitWater.Play(); GameObject Tobject = (GameObject)Instantiate(m_HitWaterParticle, transform.position + transform.forward * m_BaozhaForward + Vector3.up * m_BaozhaUp, transform.rotation); Destroy(Tobject, 0.5f); } if (other.tag == "dan1") { m_EatJiasuAudio.Play(); m_JiasuAudio.Play(); GameObject temp = (GameObject)Instantiate(m_JiasuPartical, other.transform.position + transform.forward * 10.0f, other.transform.rotation); Destroy(temp, 0.5f); //Destroy(other.gameObject); CheckDaoJuListObj(other.gameObject); } if (other.tag == "dan3") { m_EatJiasuAudio.Play(); m_JiasuAudio.Play(); GameObject temp = (GameObject)Instantiate(m_JiasuPartical, other.transform.position + transform.forward, other.transform.rotation); Destroy(temp, 0.5f); //Destroy(other.gameObject); CheckDaoJuListObj(other.gameObject); } if (other.tag == "zhong") { GameObject temp = (GameObject)Instantiate(m_JiashiPartical, other.transform.position, other.transform.rotation); //Destroy(other.gameObject); CheckDaoJuListObj(other.gameObject); Destroy(temp, 0.5f); m_EatJiashiAudio.Play(); m_JiashiAudio.Play(); } if (other.tag == "paizhao0") { m_Texture[0].SetActive(true); } if (other.tag == "paizhao1") { m_Texture[1].SetActive(true); } if (other.tag == "paizhao2") { m_Texture[2].SetActive(true); } if (other.tag == "paizhao3") { m_Texture[3].SetActive(true); } if (other.tag == "paizhao4") { m_Texture[4].SetActive(true); } if (other.tag == "dianshan1") { m_PlayerAnimator.SetTrigger("IsDianshan1"); m_PlayerAnimator.SetBool("IsTurnRight", false); m_PlayerAnimator.SetBool("IsTurnleft", false); m_PlayerAnimator.SetBool("IsRoot", false); //m_PlayerAnimator.SetTrigger("IsQifei"); m_FeibanAudio.Play(); // m_TeXiao1Audio.Play(); GameObject temp = (GameObject)Instantiate(m_FeibanEffectObj, transform.position, transform.rotation); Destroy(temp, 4.2f); } if (other.tag == "offshuihua") { m_particalEffect[0].SetActive(false); m_particalEffect[1].SetActive(false); m_particalEffect[2].SetActive(false); m_ShuihuaAudio.Stop(); } if (other.tag == "openshuihua") { m_particalEffect[0].SetActive(true); m_particalEffect[1].SetActive(true); m_particalEffect[2].SetActive(true); m_ShuihuaAudio.Play(); } if (other.tag == "opencamera") { m_otherCamerCtrl.enabled = false; m_Ctrlcamera.enabled = true; } if (other.tag == "showniao") { m_niao.SetActive(true); iTweenEvent iTweenEventCom = m_niao.GetComponent <iTweenEvent>(); iTweenEventCom.Start(); } if (other.tag == "hideniao") { m_niao.SetActive(false); } if (other.tag == "hui") { m_HuiEffect.saturation = 0.0f; m_EndTexture.SetActive(true); } if (other.tag == "jianyin") { ShowHidenCtrl.m_IsOpen = true; } // if(other.tag == "changecamera") // { // iTweenEvent.GetEvent(this.gameObject,"New Path1").Stop(); // iTweenEvent.GetEvent(this.gameObject,"New Path2").Play(); // } }
private static void FixContainer() { if (!HasSelection()) { Debug.Log(" Current selection is empty."); return; } GameObject gameObject = CurrentGameObject(); if (gameObject == null) { Debug.Log(" Cannot set position if the current selection is not a GameObject."); return; } Container sibling = gameObject.transform.parent.GetComponentInChildren <Container>(); if (sibling == null) { Debug.Log(" No sibling template found."); return; } foreach (iTweenEvent eachTemplate in sibling.GetComponentsInChildren <iTweenEvent>()) { iTweenEvent iTweenEvent = gameObject.AddComponent <iTweenEvent>(); iTweenEvent.tweenName = eachTemplate.tweenName; iTweenEvent.type = eachTemplate.type; iTweenEvent.Values = eachTemplate.Values; iTweenEvent.playAutomatically = eachTemplate.playAutomatically; } ObjectAnim objectAnim = gameObject.AddComponent <ObjectAnim>(); objectAnim.m_Target = gameObject; Vector3 location = gameObject.transform.localPosition; location.x = 0.107f; gameObject.transform.localPosition = location; gameObject.transform.localRotation = Quaternion.identity; ObjectGuid objectGuid = gameObject.AddComponent <ObjectGuid>(); objectGuid.m_Guid = Guid.NewGuid().ToString(); Container container = gameObject.AddComponent <Container>(); container.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = sibling.m_LocalizedDisplayName.m_LocalizationID }; container.m_CloseAudio = sibling.m_CloseAudio; container.m_CapacityKG = sibling.m_CapacityKG; container.m_DecayScalar = sibling.m_DecayScalar; container.m_DefaultFilter = sibling.m_DefaultFilter; container.m_OpenAudio = sibling.m_OpenAudio; container.m_OpenDelaySeconds = sibling.m_OpenDelaySeconds; gameObject.AddComponent <BoxCollider>(); gameObject.layer = vp_Layer.Container; }
/// <summary> /// /// </summary> /// <param name="target"></param> /// <param name="hash"></param> public WaitForAnimation(GameObject target, iTweenHashObject hash) { tweenEvent = target.GetComponent <iTweenEvent>() ?? target.AddComponent <iTweenEvent>(); tweenEvent.tweenHash = hash; tweenEvent.Play(); }
public void Init () { mRotateEvent = iTweenEvent.GetEvent (sprite.gameObject, "RotateEvent"); mJumpEvent = iTweenEvent.GetEvent (gameObject, "JumpEvent"); characterTransform.localScale = new Vector3 (0.8f, 0.8f, 0.8f); }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); scvar = GetComponent <iTweenEvent> (); StartCoroutine("text1"); }