protected void Diu3huo() { DiuName = "jn_dihuo_3"; vx = Mathf.Abs(vx); vx = this.transform.localScale.x > 0 ? vx * -1 : vx; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.position; o.transform.parent = this.transform.parent; o.GetComponent <Rigidbody2D>().velocity = new Vector2(vx, vy); print("diuhuo1 " + o.name); GameObject o2 = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o2.transform.position = PosDiu.position; o2.transform.parent = this.transform.parent; o2.GetComponent <Rigidbody2D>().velocity = new Vector2(vx + 4, vy + 3); print("diuhuo2 " + o2.name); GameObject o3 = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o3.transform.position = PosDiu.position; o3.transform.parent = this.transform.parent; o3.GetComponent <Rigidbody2D>().velocity = new Vector2(vx + 6, vy + 6); print("diuhuo3 " + o3.name); }
void ShowJiguanObj(int DDNums, float dx = 0, string ObjName = "", bool IsQian = true, bool IsInGuais = false) { float DestanceY = Mathf.Abs(TopPos.position.y - DownPos.position.y) / (DDNums + 1); for (int i = 0; i < DDNums; i++) { //string ObjName = "G_Feixingqi_1"; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(ObjName); o.name = ObjName; if (IsQian) { o.transform.position = new Vector3(palyerJijis.transform.position.x + 166 + dx + GlobalTools.GetRandomDistanceNums(36), TopPos.position.y - DestanceY * (i + 1) + 5 - GlobalTools.GetRandomDistanceNums(10), JiguanZ); } else { o.transform.position = new Vector3(palyerJijis.transform.position.x - 36 - GlobalTools.GetRandomDistanceNums(6), TopPos.position.y - DestanceY * (i + 1) + 5 - GlobalTools.GetRandomDistanceNums(10), JiguanZ); } if (IsInGuais) { o.transform.parent = Guais.transform; } else { o.transform.parent = this.transform.parent; } } }
private void RenzhebiaoHeng() { //throw new NotImplementedException(); DiuName = "AQ_renzhebiao"; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.position; o.transform.parent = this.transform.parent; o.name = DiuName; //public void GetSpeedV2() //{ // GetComponent<Rigidbody2D>().velocity = Vector2.zero; // GetComponent<Rigidbody2D>().velocity = FSFXV2; //} //public void SetV2Speed(Vector2 v2) //{ // FSFXV2 = v2; //} o.GetComponent <JN_Date>().team = this.GetComponent <RoleDate>().team; o.GetComponent <TX_RenzheBiao>().SetV2Speed(new Vector2(-20 * this.transform.localScale.x, 0)); print("忍者镖的 速度 " + o.GetComponent <Rigidbody2D>().velocity); o.GetComponent <TX_RenzheBiao>().GetSpeedV2(); //o.GetComponent<Rigidbody2D>().velocity = o.GetComponent<TX_RenzheBiao>().FSFXV2; }
void Diu4Du() { vx = Mathf.Abs(vx); vx = this.transform.localScale.x > 0 ? vx * -1 : vx; vy = 10; DiuName = "jn_dihuo_4"; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.position; o.transform.parent = this.transform.parent; o.name = DiuName; o.GetComponent <Rigidbody2D>().velocity = new Vector2(vx, vy); GameObject o2 = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o2.transform.position = PosDiu.position; o2.transform.parent = this.transform.parent; o2.name = DiuName; o2.GetComponent <Rigidbody2D>().velocity = new Vector2(vx + 4, vy + 3); GameObject o3 = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o3.transform.position = PosDiu.position; o3.transform.parent = this.transform.parent; o3.name = DiuName; o3.GetComponent <Rigidbody2D>().velocity = new Vector2(vx + 6, vy + 6); GameObject o4 = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o4.transform.position = PosDiu.position; o4.transform.parent = this.transform.parent; o4.name = DiuName; o4.GetComponent <Rigidbody2D>().velocity = new Vector2(vx + 6, vy - 6); }
//大型怪 持续伤害效果显示 多点显示 protected void DuodianShowChixuXiaoguo(string TXName) { for (int i = 0; i < DuodianTXList.Count; i++) { //交叉循环了 有点 耗性能 GameObject tx = GetTXInList(TXName); if (tx == null) { tx = GlobalTools.GetGameObjectInObjPoolByName(TXName); } //GameObject tx = GlobalTools.GetGameObjectInObjPoolByName(TXName); tx.gameObject.SetActive(true); tx.transform.position = DuodianTXList[i].position; tx.transform.parent = this.transform; if (TXBeishu != 0) { tx.transform.localScale = new Vector3(TXBeishu, TXBeishu, TXBeishu); } //print(" shengchengde shihou "+ tx.name); tx.name = TXName; //print(" shengchengde shihou >>>>>>>>>>>> " + tx.name); tx.GetComponent <ParticleSystem>().Play(); ChixuDuodianTXList.Add(tx); } }
private void ShowYanmu() { //throw new NotImplementedException(); GameObject yanmu = GlobalTools.GetGameObjectInObjPoolByName(YanmuName); yanmu.transform.position = this.transform.position; yanmu.transform.parent = this.transform.parent; }
void ShowRenzhebiao(string ObjName, Vector2 v2, float g = 0) { GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.position; o.transform.parent = this.transform.parent; o.name = DiuName; o.GetComponent <Rigidbody2D>().gravityScale = g; o.GetComponent <JN_Date>().team = this.GetComponent <RoleDate>().team; o.GetComponent <TX_RenzheBiao>().SetV2Speed(v2); o.GetComponent <TX_RenzheBiao>().GetSpeedV2(); }
protected void JinGaoStart() { string TX_name = "TX_LaixiJinggao"; TX_LaixiJinggao = GlobalTools.GetGameObjectInObjPoolByName(TX_name); TX_LaixiJinggao.name = TX_name; JinggaoXObj = GlobalTools.FindObjByName(GlobalTag.MAINCAMERA).GetComponent <CameraController>().CameraAirPosLeftX; TX_LaixiJinggao.transform.parent = this.transform.parent; TX_LaixiJinggao.transform.position = new Vector2(JinggaoXObj.position.x, this.transform.position.y); TX_LaixiJinggao.transform.localScale = new Vector3(1.6f, 1.6f, 1.6f); player = GlobalTools.FindObjByName(GlobalTag.PlayerJijiaObj); }
private void Dianqiang() { //throw new NotImplementedException(); DiuName = "TX_Dianqiang_2"; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.position; o.transform.parent = this.transform.parent; o.name = DiuName; float _vx = this.transform.localScale.x > 0 ? -1 : 1; o.GetComponent <TX_Dianqiang>().SetSpeedFX(_vx); }
void FasheHoufangDaodan(int DDNums) { float DestanceY = Mathf.Abs(TopPos.position.y - DownPos.position.y) / (DDNums + 1); for (int i = 0; i < DDNums; i++) { string DDName = HoufangDaodan[GlobalTools.GetRandomNum(HoufangDaodan.Count)]; GameObject daodan = GlobalTools.GetGameObjectInObjPoolByName(DDName); daodan.name = DDName; daodan.transform.position = new Vector3(palyerJijis.transform.position.x - 36 - GlobalTools.GetRandomDistanceNums(6), TopPos.position.y - DestanceY * (i + 1) + 5 - GlobalTools.GetRandomDistanceNums(10), JiguanZ); daodan.transform.parent = this.transform.parent; } }
void ShowKonglei(int DDNums, float dx = 0) { float DestanceY = Mathf.Abs(TopPos.position.y - DownPos.position.y) / (DDNums + 1); for (int i = 0; i < DDNums; i++) { string DDName = "JG_Konglei"; GameObject lei = GlobalTools.GetGameObjectInObjPoolByName(DDName); lei.name = DDName; lei.transform.position = new Vector3(palyerJijis.transform.position.x + 166 + dx + GlobalTools.GetRandomDistanceNums(36), TopPos.position.y - DestanceY * (i + 1) + 5 - GlobalTools.GetRandomDistanceNums(10), JiguanZ); lei.transform.parent = this.transform.parent; } }
void ChuGuai(Transform pos) { if (IsShowTX) { GameObject tx = GlobalTools.GetGameObjectInObjPoolByName(TX_GuaiOutName); tx.transform.position = pos.position; } GameObject guai = GlobalTools.GetGameObjectInObjPoolByName(OutGuaiName); guai.transform.position = pos.position; print(" 出现 纸人 怪 !!! " + guai.transform.position); }
protected override void OtherOver() { //好像可以 进来多次 生成 很多炸弹 if (IsZibao) { return; } IsZibao = true; GameObject TX_Baozha = GlobalTools.GetGameObjectInObjPoolByName(TX_ZiBao); TX_Baozha.transform.position = this.gameObject.transform.position; TX_Baozha.transform.parent = this.gameObject.transform.parent; this._roleDate.live = 0; }
void ShowZidan2() { GameObject zidan1 = GlobalTools.GetGameObjectInObjPoolByName(ZidanName); zidan1.name = ZidanName; zidan1.transform.position = GandaodanPos2.position; zidan1.transform.parent = this.transform.parent; float _speedY = 300 + GlobalTools.GetRandomDistanceNums(300); //if (this.transform.position.y < _player.transform.position.y) //{ // _speedY *= -1; //} zidan1.GetComponent <Rigidbody2D>().AddForce(new Vector2(300 + GlobalTools.GetRandomDistanceNums(300), _speedY)); }
GameObject CreateHuo(Transform pos = null) { GameObject huoyan = GlobalTools.GetGameObjectInObjPoolByName(Huoyan); //GameObject huoyan = GlobalTools.GetGameObjectByName(Huoyan); huoyan.transform.parent = this.transform.parent; huoyan.name = Huoyan; huoyan.gameObject.SetActive(true); if (pos) { float fanwei = 2; float ___x = pos.position.x - fanwei + GlobalTools.GetRandomDistanceNums(fanwei); float ___y = pos.position.y - fanwei + GlobalTools.GetRandomDistanceNums(fanwei); Vector2 newPos = new Vector2(___x, ___y); huoyan.transform.position = newPos; } else { huoyan.transform.position = this.transform.position; } //****** 2021-11-08 注意 直接在这生成粒子 调用粒子系统-直接生成 直接生成 直接生成 不要return出去给变量 在外面调用return生成后 有概率不被摄像机渲染 注意 粒子系统 都直接生成 靠 ***************** //print(huoyan.GetComponent<ParticleSystem>().IsAlive()+" ?stop? "+huoyan.GetComponent<ParticleSystem>().isStopped+" --粒子数 "+ huoyan.GetComponent<ParticleSystem>().particleCount); //if (huoyan.GetComponent<ParticleSystem>().particleCount == 0) //{ // huoyan.gameObject.SetActive(false); // huoyan = GlobalTools.GetGameObjectInObjPoolByName(Huoyan); // huoyan.transform.parent = this.transform.parent; // if (pos) // { // huoyan.transform.position = pos.position; // } // else // { // huoyan.transform.position = this.transform.position; // } // huoyan.name = Huoyan; // huoyan.gameObject.SetActive(true); //} huoyan.GetComponent <ParticleSystem>().Simulate(0.0f); huoyan.GetComponent <ParticleSystem>().Play(); return(huoyan); }
void CrtGuai(string guaiName) { GameObject guai = GlobalTools.GetGameObjectInObjPoolByName(guaiName); guai.name = guaiName; //guai.transform.position = GuaiOutPos1.position; if (GlobalTools.GetRandomNum() >= 50) { guai.transform.position = GuaiOutPos1.position; } else { guai.transform.position = GuaiOutPos2.position; } guai.GetComponent <AIBase>().isFindEnemy = true; GuaiObjs.Add(guai); }
void GetQianlei(float dx, float dy, bool isUp = true) { string DDName = "JG_Konglei"; GameObject lei = GlobalTools.GetGameObjectInObjPoolByName(DDName); lei.name = DDName; if (isUp) { lei.transform.position = new Vector3(palyerJijis.transform.position.x + 166 + dx + GlobalTools.GetRandomDistanceNums(dx), TopPos.position.y - GlobalTools.GetRandomDistanceNums(dy), JiguanZ); } else { lei.transform.position = new Vector3(palyerJijis.transform.position.x + 166 + dx + GlobalTools.GetRandomDistanceNums(dx), DownPos.position.y + GlobalTools.GetRandomDistanceNums(dy), JiguanZ); } lei.transform.parent = this.transform.parent; }
void GetObjOut(float __x, float __y, bool isRZB = false) { GameObject o = GlobalTools.GetGameObjectInObjPoolByName(ObjName); __x = this.transform.localScale.x > 0 ? -__x : __x; o.transform.position = zidanDian1.position; o.transform.parent = this.transform.parent; o.name = ObjName; if (isRZB) { o.GetComponent <TX_RenzheBiao>().SetV2Speed(new Vector2(__x, __y)); o.GetComponent <TX_RenzheBiao>().GetSpeedV2(); } else { o.GetComponent <Rigidbody2D>().velocity = new Vector2(__x, __y); } }
private void Yanwudan() { //throw new NotImplementedException(); DiuName = "TX_yinshenYM1"; GameObject o = GlobalTools.GetGameObjectInObjPoolByName(DiuName); o.transform.position = PosDiu.transform.position; o.transform.parent = this.transform.parent; o.name = DiuName; //o.GetComponent<TX_RenzheBiao>().SetZDSpeed(10); //o.GetComponent<TX_RenzheBiao>().SetZiDanSpeedByFX(this.transform.localScale.x); //public void SetZiDanSpeedByFX(float scaleX) //{ // _isFSByFX = true; // //FSFXV2 = new Vector2(1, 0); // FSFXV2 *= scaleX * speeds; //} }
protected override void ChixuSkillStarting() { //base.ChixuSkillStarting(); if (!_isGetStart) { return; } if (!GetComponent <AIBase>().isActioning) { TheSkillOver(); return; } if (_roleDate.isBeHiting || _roleDate.isDie) { TheSkillOver(); //print("------> 进来没?? "+ GetComponent<Rigidbody2D>().velocity); if (_roleDate.isDie) { GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); } return; } if (_gameBody.IsHitWall || IsHitWall2) { GetOver(); return; } if (DisX >= YishanDistance) { GetOver(); return; } if (!IsStopSelf) { IsStopSelf = true; _gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero; } if (!IsSkillShowOut) { IsSkillShowOut = true; //print("zd acName: "+ACName); if (ACName != "") { _gameBody.isAcing = true; //_gameBody.GetDB().animation.GotoAndPlayByFrame(ACName, 0, 1); _gameBody.GetDB().animation.GotoAndStopByFrame(ACName); _gameBody.isAcing = true; GetComponent <TempAddValues>().TempAddYZ(TempAddYZ, StartDelayTimes + 1.4f); } } if (_isGetStart) { if (IsStartDelayOver()) { if (!IsTanshe) { IsTanshe = true; vx = Mathf.Abs(vx); vx = this.transform.localScale.x > 0 ? vx * -1 : vx; ZishenHitKuai.SetActive(false); if (YishanHitKuai) { YishanHitKuai.SetActive(true); } _gameBody.GetDB().animation.GotoAndPlayByFrame(ACName, 0, 1); //这里将 攻击属性 改成了 非碰撞 GetComponent <JN_Date>().HitInSpecialEffectsType = 1; _gameBody.IsJiasu = true; GameObject tx = GlobalTools.GetGameObjectInObjPoolByName("TX_Yishan_1"); tx.transform.position = this.transform.position; tx.transform.localScale = new Vector3(this.transform.localScale.x, 1, 1); tx.transform.parent = this.transform.parent; } //if (_gameBody.GetDB().animation.lastAnimationState.isCompleted) //{ // print(" jiehsu maammamamamamam "); //} if (_gameBody.GetDB().animation.lastAnimationName == ACName) { if (StartParticle != null && !IsStartParticle) { IsStartParticle = true; //print("zd qs 播放 起手特效"); StartParticle.gameObject.SetActive(true); StartParticle.Play(); } //print("------------------?????? " + ACName + " sudu " + GetComponent<Rigidbody2D>().velocity); if (_gameBody.GetDB().animation.isCompleted) { //print("??????? 结束 "); //print("??????? 结束 "); //print("??????? 结束 "); _gameBody.GetDB().animation.Stop(); } GetComponent <Rigidbody2D>().velocity = new Vector2(vx, 0); if (YanChen) { YanChen.Play(); } } else { print("跳出了 一闪动作 结束"); GetOver(); } //GetComponent<Rigidbody2D>().velocity = new Vector2(vx, 0); //if (YanChen) YanChen.Play(); DisX = Mathf.Abs(this.transform.position.x - thisChushiX); } } }
void DianTX() { if (_roledate.isDie) { return; } //_gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero; if (DuodianTXList.Count != 0) { DuodianShowChixuXiaoguo(DianTXName); } else { if (!_DianTXObj) { _DianTXObj = GlobalTools.GetGameObjectInObjPoolByName(DianTXName); _DianTXObj.transform.position = this.transform.position; _DianTXObj.transform.parent = this.transform; //_DUTXObj.GetComponent<ParticleSystem>().shape. } if (_DianTXObj) { _DianTXObj.gameObject.SetActive(true); _DianTXObj.GetComponent <ParticleSystem>().Play(); } } float dianshanghai = _DianShanghai; if (dianshanghai < 0) { dianshanghai = 0; } print(" 弱 电伤害 " + dianshanghai + " 抗电几率 " + _roledate.KangDianMabiJilv); if (_roledate.KangDianMabiJilv < 0) { dianshanghai *= Mathf.Abs(_roledate.KangDianMabiJilv); print("弱电伤害!!!!!!!!!" + dianshanghai); } _roledate.live -= dianshanghai; //print(" 毒 持续伤害 " + dushanghai + " 剩余生命 " + _roledate.live); if (GlobalTools.GetRandomNum() > 70) { //if (_audioBeHit && !_audioBeHit.isPlaying) _audioBeHit.Play(); if (_roleAudio.BeHit_1 && !_roleAudio.BeHit_1.isPlaying) { _roleAudio.BeHit_1.Play(); } } if (_roledate.live == 0) { //DuTXDaShow(); //if (_audioDie && !_audioDie.isPlaying) _audioDie.Play(); if (_roleAudio.BeHit_1 && !_roleAudio.BeHit_1.isPlaying) { _roleAudio.BeHit_1.Play(); } } }