protected override void ACSkillShowOut() { print(" dongzuo name shijian **********************ac " + TXName + " 重锤 "); //GetComponent<ShowOutSkill>().ShowOutSkillByName(TXName, true); Luoshi(); //if (!DachuiZhengdi1.activeSelf) DachuiZhengdi1.SetActive(true); //if (!DachuiZhengdi2.activeSelf) DachuiZhengdi2.SetActive(true); GameObject skillObj = Resources.Load(TX_Zhongchui1Name) as GameObject; GameObject skill = ObjectPools.GetInstance().SwpanObject2(skillObj); skill.GetComponent <JN_base>().atkObj = this.gameObject; skill.transform.position = Zhongchui1_pos.position; skill.transform.parent = this.gameObject.transform.parent; //skill.transform.position = Zhongchui1_pos.position; GameObject skillObj2 = Resources.Load(TX_Zhongchui2Name) as GameObject; GameObject skill2 = ObjectPools.GetInstance().SwpanObject2(skillObj2); skill2.GetComponent <JN_base>().atkObj = this.gameObject; skill2.transform.position = Zhongchui2_pos.position; skill2.transform.parent = this.gameObject.transform.parent; ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.CAMERA_SHOCK, "z2-0.6"), this); //return; //GameObject skillObj = Resources.Load(TXName) as GameObject; //if (skillObj == null) //{ // print(" skillObj = null "); // //Time.timeScale = 0; // return; //} ////GameObject skill = ObjectPools.GetInstance().SwpanObject2(skillObj); //if (skill.GetComponent<LiziJNControl>()) //{ // skill.GetComponent<LiziJNControl>().GetLiziObj().GetComponent<JN_base>().atkObj = this.gameObject; //} //if (FasheiPointNum == 1) //{ // skill.transform.position = zidanDian1.position; //} //else if (FasheiPointNum == 2) //{ // skill.transform.position = zidanDian2.position; //} //if (IsNeedSetScaleX) //{ // skill.transform.localScale = this.gameObject.transform.localScale; //} //skill.transform.parent = this.gameObject.transform.parent; //_gameBody.GetDB().animation.lastAnimationState.timeScale = 0.1f; //这里要实现 JNDate 赋值 }
void ShowDiandings() { Remove4Dianding(); for (int i = 0; i < 4; i++) { GameObject dianding = ObjectPools.GetInstance().SwpanObject2(Resources.Load(DiandingName) as GameObject); dianding.transform.position = new Vector2(DianPos[i].position.x, DianPos[i].position.y + GlobalTools.GetRandomDistanceNums(2));// DianPos[i].position; dianding.GetComponent <JN_base>().atkObj = this.gameObject; dianding.GetComponent <JN_Date>().team = this.GetComponent <JN_Date>().team; dianding.GetComponent <RoleDate>().Live = dianding.GetComponent <RoleDate>().maxLive; dianding.GetComponent <TX_Dianding>().GetStart(); DiandingList.Add(dianding); //判断 该位置 是否 已经存在 电钉了 //if (!IsHasDiandingInPos(i)) //{ // GameObject dianding = ObjectPools.GetInstance().SwpanObject2(Resources.Load(DiandingName) as GameObject); // dianding.transform.position = DianPos[i].position; // dianding.GetComponent<JN_base>().atkObj = this.gameObject; // dianding.GetComponent<JN_Date>().team = this.GetComponent<JN_Date>().team; // dianding.GetComponent<RoleDate>().Live = dianding.GetComponent<RoleDate>().maxLive; // dianding.GetComponent<TX_Dianding>().GetStart(); // DiandingList.Add(dianding); //} } }
protected virtual void ShowACTX(string type, EventObject eventObject) { //print(type+" ??????? "+ eventObject.name); if (type == EventObject.FRAME_EVENT) { if (eventObject.name == "ac") { print("GetZSName> " + GetZSName + " ZSName " + ZSName); if (GetZSName == ZSName) { ACSkillShowOut(); } } if (eventObject.name == "zd" || eventObject.name == "zd2") { //闪一下点特效 GameObject shanGuang = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TX_zidan1shan") as GameObject); //GlobalTools.GetGameObjectByName("TX_zidan1shan"); shanGuang.transform.position = zidanDian1.position; //判断子弹类型 和 动作类型 //zidan_1 zidan_2 //zidan_1_1 第三个1 是动作 atk_zd_+ '1' 如果没有就是 1 //1.普通子弹 2.高速子弹 3.跟踪子弹 4.3连弹 5.直线弹 //GameObject zidan = ObjectPools.GetInstance().SwpanObject2(Resources.Load(ZDName) as GameObject); //zidan.transform.position = zidanDian.position; //zidan.transform.localScale = this.transform.localScale; //放出子弹 子弹方向 点位置 - 目标位置+ -Y //print("发射子弹!!!!!!!!!!!!!!!!!!"); } } }
//间隔 先后 下砸 void JianGeXianhouXiaza() { for (int i = 0; i < intArr.Count; i++) { GameObject skillObj = Resources.Load(TXName) as GameObject; GameObject skill = ObjectPools.GetInstance().SwpanObject2(skillObj); skill.GetComponent <JN_base>().atkObj = this.gameObject; //出现位置 float __x = TLPos.position.x + 1.5f * intArr[i]; float __y = TLPos.position.y; if (i % 2 == 1) { __y += 1; skill.GetComponent <TX_XiazaiZidan>().SetZidanXiazaTime(1); } else { skill.GetComponent <TX_XiazaiZidan>().SetZidanXiazaTime(1.5f); } skill.transform.position = new Vector2(__x, __y); skill.transform.parent = this.gameObject.transform.parent; } }
protected virtual void ShowACTX(string type, EventObject eventObject) { //print(type+" ??????? "+ eventObject.name); if (type == EventObject.FRAME_EVENT) { //print("子弹事件 "+ eventObject.name); if (eventObject.name == "zd" || eventObject.name == "zd2") { //闪一下点特效 GameObject shanGuang = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TX_zidan1shan") as GameObject); //GlobalTools.GetGameObjectByName("TX_zidan1shan"); print(shanGuang + " ------ ?? " + zidanDian); shanGuang.transform.position = zidanDian.position; //判断子弹类型 和 动作类型 //zidan_1 zidan_2 //zidan_1_1 第三个1 是动作 atk_zd_+ '1' 如果没有就是 1 //1.普通子弹 2.高速子弹 3.跟踪子弹 4.3连弹 5.直线弹 GameObject zidan = ObjectPools.GetInstance().SwpanObject2(Resources.Load(ZDName) as GameObject); zidan.transform.position = zidanDian.position; zidan.transform.localScale = this.transform.localScale; //*************这里如果不加 如果有个 3散弹 的 对象池 就会 无法射击出去 注意************ zidan.GetComponent <TX_zidan>().IsAtkAuto = true; //放出子弹 子弹方向 点位置 - 目标位置+ -Y //print("发射子弹!!!!!!!!!!!!!!!!!!"); } } }
void DuOver() { _DuShanghai = 0; _DuShanghaiTimes = 0; _DuJishi = 0; IsDu = false; _CMaxDuChixuShijian = 0; if (_DUTXObj) { _DUTXObj.GetComponent <ParticleSystem>().Stop(); ObjectPools.GetInstance().DestoryObject2(_DUTXObj.gameObject); } //print(" 持续 毒伤害 结束 !!!! "+ ChixuDuodianTXList.Count); if (ChixuDuodianTXList.Count != 0) { for (int i = ChixuDuodianTXList.Count - 1; i >= 0; i--) { if (ChixuDuodianTXList[i].name == DuTXName) { IshasNameTX = true; ChixuDuodianTXList[i].GetComponent <ParticleSystem>().Stop(); ObjectPools.GetInstance().DestoryObject2(ChixuDuodianTXList[i].gameObject); //ChixuDuodianTXList.Remove(ChixuDuodianTXList[i]); } } if (IshasNameTX) { return; } } }
void ToziDan() { if (TX_ZidanFS) { TX_ZidanFS.Play(); } if (Audio_ZDFS) { Audio_ZDFS.Play(); } int zidanNums = 2 + GlobalTools.GetRandomNum(MoveZidanNums); for (int i = 0; i < zidanNums; i++) { float __x = 1 + GlobalTools.GetRandomDistanceNums(3); __x = this.transform.localScale.x > 0?-__x: __x; float __y = GlobalTools.GetRandomDistanceNums(-3) + GlobalTools.GetRandomDistanceNums(3); Vector2 v2 = new Vector2(__x, __y); GameObject zidan = ObjectPools.GetInstance().SwpanObject2(Resources.Load(ZidanName) as GameObject); zidan.GetComponent <TX_zidan>().CloseAutoFire(); zidan.GetComponent <Rigidbody2D>().velocity = Vector2.zero; zidan.transform.localScale = this.transform.localScale; zidan.transform.position = ZidanFasheiPos.position; zidan.GetComponent <Rigidbody2D>().velocity = v2; } }
protected virtual void Boom() { string bzName = "TX_HuoyanBaozha_2"; GameObject baozha = ObjectPools.GetInstance().SwpanObject2(Resources.Load(bzName) as GameObject); baozha.transform.position = this.transform.position; baozha.name = bzName; if (baozha.GetComponent <JN_Date>()) { baozha.GetComponent <JN_Date>().team = this.GetComponent <JN_Date>().team; } baozha.GetComponent <ParticleSystem>().Play(); if (GetComponent <Rigidbody2D>()) { GetComponent <Rigidbody2D>().velocity = Vector2.zero; } string BZSanpianName = "TX_Sanpians_1"; int nums = 10 + GlobalTools.GetRandomNum(14); for (int i = 0; i < nums; i++) { GameObject baozhaSanpian = GlobalTools.GetGameObjectInObjPoolByName(BZSanpianName); baozhaSanpian.name = BZSanpianName; Vector2 speed = new Vector2(300 - GlobalTools.GetRandomDistanceNums(600), 1000 - GlobalTools.GetRandomDistanceNums(2000)); speed = new Vector2(speed.x + 200 + GlobalTools.GetRandomDistanceNums(400), speed.y); if (GlobalTools.GetRandomNum() > 70) { speed = new Vector2(-200 - GlobalTools.GetRandomDistanceNums(400), speed.y); } baozhaSanpian.transform.position = this.transform.position; baozhaSanpian.GetComponent <Rigidbody2D>().AddForce(speed); } }
public IEnumerator IEDieDestory(float time) { yield return(new WaitForSeconds(time)); ObjectPools.GetInstance().DestoryObject2(this.gameObject); //this.gameObject.SetActive(false); }
void HitTX2(string txName) { GameObject hitTx = Resources.Load(txName) as GameObject; hitTx = ObjectPools.GetInstance().SwpanObject2(hitTx); hitTx.transform.position = _gameBody.transform.position; hitTx.transform.parent = _gameBody.transform; }
//击中特效 void HitTX(float psScaleX, string txName) { GameObject hitTx = Resources.Load(txName) as GameObject; hitTx = ObjectPools.GetInstance().SwpanObject2(hitTx); hitTx.transform.position = gameBody.transform.position; hitTx.transform.localScale = new Vector3(1, 1, psScaleX); }
//将 徽章UI存入对象池 public void RemoveAllSkillHZUI() { foreach (GameObject o in HZList) { ObjectPools.GetInstance().DestoryObject2(o); } HZList.Clear(); }
void RemoveSelf() { IsStarting = false; print("////*********************************************************************************dianqiang"); print("////*********************************************************************************dianqiang"); print("////*********************************************************************************dianqiang 移除"); //gameObject.SetActive(false); ObjectPools.GetInstance().DestoryObject2(this.gameObject); }
void FangDian() { GameObject dianqiangHeng = ObjectPools.GetInstance().SwpanObject2(Resources.Load(DianQiangName) as GameObject); dianqiangHeng.transform.position = new Vector2(DiPos.position.x, DiPos.position.y + 0.6f); dianqiangHeng.GetComponent <JN_base>().atkObj = this.GetComponent <JN_base>().atkObj; dianqiangHeng.GetComponent <JN_Date>().team = this.GetComponent <JN_Date>().team; dianqiangHeng.GetComponent <TX_Dianqiang>().GetStart(); }
protected override void ACSkillShowOut() { print(" dongzuo name shijian **********************ac " + TXName); //横向子弹 先浮起 然后 直线 朝着 玩家方向 float nums = GlobalTools.GetRandomNum(4) + 4; for (int i = 0; i < nums; i++) { GameObject skillObj = Resources.Load(TXName) as GameObject; GameObject skill = ObjectPools.GetInstance().SwpanObject2(skillObj); skill.GetComponent <JN_base>().atkObj = this.gameObject; //出现位置 float __x = this.transform.position.x - 2 + GlobalTools.GetRandomDistanceNums(4); float __y = this.transform.position.y - 1 + GlobalTools.GetRandomDistanceNums(1); skill.transform.position = new Vector2(__x, __y); skill.transform.parent = this.gameObject.transform.parent; } //GetComponent<ShowOutSkill>().ShowOutSkillByName(TXName, true); //GameObject skillObj = Resources.Load(TXName) as GameObject; //GameObject skill = ObjectPools.GetInstance().SwpanObject2(skillObj); //if (skill.GetComponent<LiziJNControl>()) //{ // skill.GetComponent<LiziJNControl>().GetLiziObj().GetComponent<JN_base>().atkObj = this.gameObject; //} //if (FasheiPointNum == 1) //{ // skill.transform.position = zidanDian1.position; //} //else if (FasheiPointNum == 2) //{ // skill.transform.position = zidanDian2.position; //} //if (IsNeedSetScaleX) //{ // skill.transform.localScale = this.gameObject.transform.localScale; //} //_gameBody.GetDB().animation.lastAnimationState.timeScale = 0.1f; //这里要实现 JNDate 赋值 }
public IEnumerator IEDestory(float time) { //Debug.Log("time "+time); //yield return new WaitForFixedUpdate(); yield return(new WaitForSeconds(time)); print(" ---->xiecheng dis Self!!! "); //this.gameObject.SetActive(false); ObjectPools.GetInstance().DestoryObject2(this.gameObject); }
void GetKuai(JN_Date jn_date, Vector3 _position) { hitKuai = Resources.Load("jn_fk") as GameObject; hitKuai = ObjectPools.GetInstance().SwpanObject2(hitKuai); hitKuai.transform.parent = this.transform; //指定 碰撞块位置 hitKuai.transform.position = _position; //指定 特效方向 hitKuai.transform.localScale = new Vector3(jn_date._scaleW, jn_date._scaleW, hitKuai.transform.localScale.z); }
public IEnumerator ShowOutTxtBar(float time) { yield return(new WaitForSeconds(time)); GameObject _cBar = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TalkBar2") as GameObject); Vector2 _talkPos = GetComponent <GameBody>().GetTalkPos(); string _msg = ChaoFengStrArr[GlobalTools.GetRandomNum(ChaoFengStrArr.Length)]; _cBar.GetComponent <UI_talkBar>().ShowTalkText(_msg, _talkPos, 1.5f); }
//一秒后 出 独白 void Dubais() { string _msg = "很好!你表现令人惊喜"; GameObject _cBar = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TalkBar2") as GameObject); Vector2 _talkPos = GetComponent <GameBody>().GetTalkPos(); //_cBar.GetComponent<UI_talkBar>(). //print("我是boss!!!! boss 的 独白 是什么?? " + _msg); _cBar.GetComponent <UI_talkBar>().ShowTalkText(_msg, _talkPos, 4); }
void OnEnable() { //this.transform.localEulerAngles = _localEulerAngles; //print("this.transform.localEulerAngles "+ this.transform.localEulerAngles); //print("this.transform.name " + this.transform.name+ " _localEulerAngles "+ _localEulerAngles+ " this.transform.localRotation " + this.transform.localRotation); if (isRadomZ) { RadomZ(); } StartCoroutine(ObjectPools.GetInstance().IEDestory2ByTime(this.gameObject, disTime)); }
void JishiDisSelf() { if (DisSelfByTimes == 0) { return; } if (TX_lizi1 && TX_lizi1.isStopped) { if (TX_lizi1) { TX_lizi1.loop = true; } if (TX_lizi2) { TX_lizi2.loop = true; } ObjectPools.GetInstance().DestoryObject2(this.gameObject); } DisSelfJishi += Time.deltaTime; if (DisSelfJishi >= DisSelfByTimes) { DisSelfJishi = 0; print("removeSelf!!!!"); //if (GetComponent<ParticleSystem>()) //{ // GetComponent<ParticleSystem>().loop = false; //} //if (GetComponentInChildren<ParticleSystem>()) //{ // GetComponentInChildren<ParticleSystem>().loop = false; //} if (TX_lizi1) { TX_lizi1.loop = false; } if (TX_lizi2) { TX_lizi2.loop = false; } if (TX_lizi1 == null) { ObjectPools.GetInstance().DestoryObject2(this.gameObject); } //ObjectPools.GetInstance().DestoryObject2(this.gameObject); //ObjectPools.GetInstance().IEDestory2ByTime(this.gameObject,0.2f); } }
void DBMoves() { if (Air_DB_List[0].transform.position.x <= LeftPos.position.x - Air_DB_List[0].GetComponent <DB_AirBase>().GetWidth() - 20) { ObjectPools.GetInstance().DestoryObject2(Air_DB_List[0]); //Air_DB_List[0].gameObject.SetActive(false); Air_DB_List.RemoveAt(0); GetJingAndPosByJingName(JingNamesList2[GlobalTools.GetRandomNum(JingNamesList2.Count)]); } }
void TimeTalkBarCallBack(float nums) { if (IsStopPlayerControl) { HitKuaiStop(); } talkBar = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TalkBar") as GameObject); talkBar.GetComponent <UI_talkBar>().ShowTalkText(_talkContent, _talkPos, _distime); IsSHowTalkBar = false; //GetComponent<TheTimer>().TimesAdd(1f, TimeTalkBarCallBack2); }
//击中特效 void Bloods(float psScaleX) { //print("fx: "+psScaleX); GameObject blood = Resources.Load("BloodSplatCritical2D1") as GameObject; blood = ObjectPools.GetInstance().SwpanObject2(blood); blood.transform.position = this.transform.position; blood.transform.localScale = new Vector3(1, 1, psScaleX); StartCoroutine(ObjectPools.GetInstance().IEDestory2ByTime(blood, 0.5f)); }
//显示碰撞方块 开始是将碰撞块放进特效 和特效一起 但是移动会导致 碰撞快 连续撞击 所以动态调用 void ShowHitFK() { GameObject hitFK = ObjectPools.GetInstance().SwpanObject2(Resources.Load("hit_fk") as GameObject); hitFK.GetComponent <HitKuai>().GetTXObj(this.gameObject, false, sacaleX); hitFK.transform.localScale = new Vector3(jn_date.hitKuaiSW, jn_date.hitKuaiSH, 1); Vector3 nv3 = new Vector3(this.transform.position.x - sacaleX * jn_date.hitKuai_xdx, this.transform.position.y + jn_date.hitKuai_xdy, this.transform.position.z); hitFK.transform.position = nv3; //print("动态创建碰撞快------------->hitFK pos "+nv3); }
void Fire() { if (FireAudio) { FireAudio.Play(); } GameObject zidan = ObjectPools.GetInstance().SwpanObject2(Resources.Load(BulletName) as GameObject); zidan.transform.position = BulletShotPot.position; zidan.GetComponent <TX_zidan>().IsAtkAuto = true; }
public virtual void RemoveSelf() { if (TX_LaixiJinggao) { ObjectPools.GetInstance().DestoryObject2(TX_LaixiJinggao); } //移除自己 StartCoroutine(ObjectPools.GetInstance().IEDestory2ByTime(this.gameObject, 0)); ResetAll(); }
public IEnumerator ShowOutTxtBar(float time) { yield return(new WaitForSeconds(time)); GameObject _cBar = ObjectPools.GetInstance().SwpanObject2(Resources.Load("TalkBar2") as GameObject); Vector2 _talkPos = GetComponent <GameBody>().GetTalkPos(); CHAOFENGMSG = ""; string _msg = CHAOFENGMSG; _cBar.GetComponent <UI_talkBar>().ShowTalkText(_msg, _talkPos, 1.5f); }
void DieBZ() { CXTX_Dianding.Stop(); //GlobalTools.GetGameObjectByName GameObject bz1 = ObjectPools.GetInstance().SwpanObject2(Resources.Load(TX_BZName) as GameObject); bz1.transform.position = BZPos1.position; GameObject bz2 = ObjectPools.GetInstance().SwpanObject2(Resources.Load(TX_BZName) as GameObject); bz2.transform.position = BZPos2.position; }
void SetZiDanSpeed(Vector2 speedV2) { //GameObject _zidan = GlobalTools.GetGameObjectByName("JG_zidanUp"); GameObject zidan = Resources.Load("JG_zidanUp") as GameObject; GameObject zidanUp = ObjectPools.GetInstance().SwpanObject2(zidan); //zidanUp.GetComponent<TX_zidan>().IsCanHit = false; zidanUp.transform.position = ZiDanPenShePos.position; //zidanUp.GetComponent<TX_zidan>().IsCanHit = true; zidanUp.GetComponent <TX_zidan>().SetV2Speed(speedV2); zidanUp.GetComponent <TX_zidan>().GetSpeedV2(); }