public override void OnBeAttack(PlayerBasic attacker) { if (isEffecting) { this.thePlayer.OnAttackWithoutEffect(attacker, attacker.ActerWuliDamage * damageReturnPercent, false, true); } }
private void extraDamageEffect(PlayerBasic playerAim) //额外添加挂在的计算脚本 { if (thePlayer.theAttackLinkNow != null && string.IsNullOrEmpty(thePlayer.theAttackLinkNow.conNameToEMY) == false) //效果不可叠加 { System.Type theType = System.Type.GetType(thePlayer.theAttackLinkNow.conNameToEMY); if (!playerAim.gameObject.GetComponent(theType)) { try { playerAim.gameObject.AddComponent(theType); //print("makeEffect3"); } catch { //无法添加这个效果 //那么就转换成伤害,造成2点真实伤害 thePlayer.OnAttack(playerAim, 2, true); //print ("canNotAddEMY"); } } else { effectBasic theEffect = playerAim.gameObject.GetComponent(theType) as effectBasic; theEffect.updateEffect(); //print ("update"); } thePlayer.theAttackLinkNow.conNameToEMY = ""; } }
public override void OnSuperBlade(PlayerBasic user, PlayerBasic aim, float Damage = 0) { float damage = Damage * addPercent; aim.ActerHp -= damage; aim.OnAttackWithoutEffect(aim, damage, true, true); }
private void makeNetStart() { //theFighter.transform.position = startPoint.transform.position; PlayerBasic thePlayerPrivate = theFighter.GetComponent <PlayerBasic> (); if (this.gameObject.tag != "AI") { if (systemValues.thePlayer == null) { systemValues.thePlayer = thePlayerPrivate; systemValues.thePlayerAnimator = thePlayerPrivate.GetComponentInChildren <Animator> (); thePlayerPrivate.isMainfighter = true; thePlayerPrivate.gameObject.AddComponent <BloodScaner> (); //这个游戏对象拥有观察血量的权利 } } //thePlayerPrivate.makeStart (); thePlayerPrivate.makeStartForPrivate(); thePlayerPrivate.GetComponent <attackLinkController> ().makeStart(); theCamera.target = thePlayerPrivate.transform; theCamera.thePlayer = thePlayerPrivate; thePlayerPrivate.GetComponent <move> ().makeStart(); theUIController.makeStart(thePlayerPrivate); //开始阶段给加一个无敌buff theFighter.gameObject.AddComponent <wudi>(); }
//有关AI计算状态----------------------------------------------------------- public void moveTotheState(FSMBasic theStateIn, PlayerBasic aim) { theStateIn.makeState(this.theMoveController, this.theAttackLlinkController, this.theAnimator, this.thethis, aim); theStateNow.OnFSMStateEnd(); theStateNow = theStateIn; theStateNow.OnFSMStateStart(); }
public override void OnAttack(PlayerBasic aim) { count = Mathf.Clamp(systemValues.hitCount / attackCountP, 0, countMax); float damageUse = count * damage; this.thePlayer.OnAttackWithoutEffect(aim, damageUse, false, true); }
void Start() { makeDestroy(); thethis = this.GetComponent <PlayerBasic> (); theMoveController = this.GetComponentInChildren <NavMeshAgent> (); theAttackLlinkController = this.GetComponent <attackLinkController> (); theAnimator = this.GetComponentInChildren <Animator> (); //print ("AI stage is inited"); theStatesSaved = new List <FSMBasic> (); //这里需要建立一个初始的状态 //theStateNow = new FSM_Search (); theStateNow = getState(4); theStateNow.makeState(theMoveController, theAttackLlinkController, theAnimator, thethis); theStateNow.OnFSMStateStart(); makeAIStart(); //AI重新激活,刷新时间 //带MeshgRenderer的有部分可优化之处 MeshRenderer theRender = this.GetComponentInChildren <MeshRenderer>(); if (theRender) { theRender.gameObject.AddComponent <FSMRenderSwitch> (); } this.transform.root.tag = "AI"; //打上标记方便找 move theMoveControllerForPlayer = this.GetComponent <move> (); if (theMoveControllerForPlayer) { theMoveControllerForPlayer.enabled = false; //AI不需要这个move控制移动 } }
public override void OnBeAttack(PlayerBasic attacker) { if (this.theTypeForAI == AIType.NET) { return; } //Vector3 minus = new Vector3 (0f , attacker.transform.rotation.eulerAngles.y - this.transform.rotation.eulerAngles.y , 0f); //this.transform.rotation = Quaternion.Lerp(this.transform.rotation , Quaternion.Euler(minus + this.transform .rotation.eulerAngles) , 360f); this.transform.LookAt(attacker.transform); //FSM_Attack attack = new FSM_Attack (); //attack.makeState (this.theMoveController, this.theAttackLlinkController,this.theAnimator, this.thethis ,attacker); //theStateNow = attack; theStateNow = getState(1); theStateNow.makeState(this.theMoveController, this.theAttackLlinkController, this.theAnimator, this.thethis, attacker); theStateNow.OnFSMStateStart(); think(); //强制思考一下,否则会有延迟 // try // { // NavMeshAgent theAgent = this.GetComponent <NavMeshAgent> (); // if(theAgent.isActiveAndEnabled) // { // theAgent.isStopped = true; // theAgent.isStopped = false; // theAgent.SetDestination (this.transform .position); // } // } // catch // { // print ("当前处于无法被设置目标的状态,因此AI会继续向原先的目的地移动"); // } angerTimer = angetTimerMax; //收到攻击的时候刷新仇恨 makeAIStart(); //AI重新激活,刷新时间 }
public override void OnBeAttack(PlayerBasic attacker) { //攻击者不是AI才能打出来击飞 if (attacker.gameObject.tag != "AI") { //moveTowards = new Vector3 (0f, 7f, 0f); float X = this.transform.position.x - attacker.transform.position.x; float Z = this.transform.position.z - attacker.transform.position.z; moveTowards = new Vector3(X, 0, Z) * 4; //moveTowards = attacker.transform .right * 4 ; moveTimer = moveTimerAll; isMoving = true; //if(theMoveController) // theMoveController.enabled = false; FS = this.GetComponent <FSMStage> (); if (FS) { FS.enabled = false; } NM = this.GetComponent <NavMeshAgent> (); if (NM && NM.isOnNavMesh) { NM.isStopped = true; } } }
public override void OnAttack(PlayerBasic aim, float TrueDamage) { //红莲的效果 if (mode == 1) { float hpSuck = aim.ActerHpMax * hpsuckOnChange; hpSuck = Mathf.Clamp(hpSuck, 0, damageSuckMax); thePlayer.ActerHp += hpSuck; //附加的各种效果 effectBasic[] effects = this.thePlayer.GetComponents <effectBasic> (); foreach (effectBasic EF in effects) { EF.OnHpUp(hpSuck); } } //劫刃的效果 else { int RN = Random.Range(0, 10); if (RN < ranNumber) { float makeDamage = TrueDamage * addPercent; this.thePlayer.OnAttackWithoutEffect(aim, makeDamage, true, true); this.thePlayer.ActerSp += Mathf.Clamp(makeDamage * spsuckPercent, 0, spAddMax); this.thePlayer.makeValueUpdate(); } } }
public override void OnAttack(PlayerBasic aim, float TrueDamage) { if (timerForAdd < timerForEffect) { aim.ActerHp += TrueDamage * damageMinus; } }
//makeDamage 有些动画是不造成伤害的 //吐槽,这个方法的调用限制有点多,实时上传如多个类型的参数就会报错......(到手的动画资源大多数只读,所以关键帧方法还是要用这种的) //这个是这个机制不够灵活的地方 /* * makeDamage参数的多种用途 * 1如果非正则可以造成伤害 * 2 如果为负数则要根据这个值减小攻击距离 * 3 如果是整数就无法造成伤害 */ public void attackForAnimation(float makeDamage) //攻击方法(带伤害) { //print ("prepareToAttack"); //防止空引用 try { if (!thePlayer) { thePlayer = this.GetComponentInParent <PlayerBasic> (); } //if (!theEMY) //theEMY = systemValues.getEMY (this.thePlayer.transform).GetComponent <PlayerBasic> (); } catch { //因为这个方法与动画播放的绑定比较紧密,因此在查看的界面中有可能会出问题 //如果没有获取到引用就说明是某些特殊的调用方式 } if (thePlayer) { extraEffectSELF(); //添加自身特效 if (thePlayer.canAttack) { Attack(makeDamage); } } }
public override void OnAttack(PlayerBasic aim) { if (thePlayer && isEffecting) { //第一次是伴随着初始化的 if (step == 0) { //第一次削减攻击力 theAim = aim; damageMinus = aim.ActerWuliDamage * aimDamageMinus; theAim.ActerWuliDamage -= damageMinus; step++; } if (step == 1) { //第二次,偷取生命值 hpup(); step++; } else if (step == 2) { //第三次,追加伤害 float damage = (aim.ActerHpMax - aim.ActerHp) * damagePercent; aim.ActerHp -= damage; this.thePlayer.OnAttackWithoutEffect(aim, damage, true, true); step++; } else { isEffecting = false; //标记,已经失效 } } }
public override void OnAttack(PlayerBasic aim) { //特殊伤害只能够生效一次 if (isEffecting) { EMYCount = Mathf.Clamp(getCount(), 0, maxEMYCountForUse); float damage = EMYCount * basicDamage; aim.ActerHp -= damage; this.thePlayer.OnAttackWithoutEffect(aim, damage, true, true); damage *= hpupRate; thePlayer.ActerHp += damage; //附加的各种效果 effectBasic [] effects = this.thePlayer.GetComponents <effectBasic> (); foreach (effectBasic EF in effects) { EF.OnHpUp(damage); } isEffecting = false; //标记,已经失效 Destroy(aim.gameObject.AddComponent <monsterBeAttack> (), beAttackBackTimer); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { playerBasic = other.GetComponent <PlayerBasic>(); playerBasic.transform.DOMove(End.transform.position, 3f).SetEase(Ease.InCubic); } }
//训诫 public override void OnAttack(PlayerBasic aim, float TrueDamage) { if (TrueDamage <= 0) { return; } aim.ActerHp -= aim.ActerHpMax * percent; }
public float timer; //持续时间 //attack 1 //jump 2 //runafter 3 //search 4 public void makeState(NavMeshAgent theMoveControllerIn, attackLinkController theAttacklinkControllerIn, Animator theAnimatorIn, PlayerBasic thethisIn, PlayerBasic theEMYIn = null) { theMoveController = theMoveControllerIn; theAttackLlinkController = theAttacklinkControllerIn; theEMY = theEMYIn; theThis = thethisIn; theAnimator = theAnimatorIn; }
public override void OnAttack(PlayerBasic user, PlayerBasic aim) { if (isCooled) { isCooled = false; aim.ActerSp -= aim.ActerSpMax * spAdd; } }
public override void OnAttack(PlayerBasic aim, float TrueDamage) { if (thePlayer) { this.thePlayer.ActerSp += spupOnAttack; float damage = TrueDamage * this.thePlayer.ActerSp * maxPercent / this.thePlayer.ActerSpMax; this.thePlayer.OnAttackWithoutEffect(aim, damage, false, true); } }
public override void OnAttack(PlayerBasic aim) { //print ("effext using"); if (isEffecting) { isEffecting = false; makeAreaAttack(aim.transform); } }
public override void OnAttack(PlayerBasic aim) { count++; if (count == countMax) { count = 0; this.thePlayer.OnAttackWithoutEffect(aim, damage, false, true); } }
public override void OnAttack(PlayerBasic aim) { if (isEffecting) { isEffecting = false; this.thePlayer.OnAttackWithoutEffect(aim, extraDamage, true, true); this.thePlayer.ActerSp -= 5f; } }
void OnTriggerEnter(Collider collisioner) { PlayerBasic PB = collisioner.gameObject.GetComponent <PlayerBasic> (); if (PB) { PB.OnBeAttack(40f); } }
public override void OnBeAttack(PlayerBasic user, PlayerBasic attacker) { user.ActerHp += hpup; effectBasic[] efs = user.GetComponents <effectBasic> (); foreach (effectBasic a in efs) { a.OnHpUp(hpup); } }
void makeSuck(PlayerBasic aim, float suckPercent = 0.02f) { float hpup = aim.ActerHpMax * suckPercent; thePlayer.ActerHp += hpup; for (int i = 0; i < thePlayer.Effects.Count; i++) { thePlayer.Effects [i].OnHpUp(hpup); } }
//暴击的时候调用 override public void OnSuperBlade(PlayerBasic aim, float Damage = 0) { foreach (lingBasic ling in lingEffects) { if (ling.isLearned()) { ling.OnSuperBlade(this.thePlayer, aim, Damage); } } }
//闪避的时候调用 override public void OnMiss(PlayerBasic attacker) { foreach (lingBasic ling in lingEffects) { if (ling.isLearned()) { ling.OnMiss(this.thePlayer, attacker); } } }
//格挡的时候调用 override public void OnShield(PlayerBasic attacker, float damageMinus = 0) { foreach (lingBasic ling in lingEffects) { if (ling.isLearned()) { ling.OnShield(this.thePlayer, attacker, damageMinus); } } }
public override void OnAttack(PlayerBasic aim) { attackCount++; if (attackCount >= attackCountMax) { float damage = aim.ActerHpMax * attackPercent; this.thePlayer.OnAttackWithoutEffect(aim, damage, false, true); attackCount = 0; } }
public override void OnAttack(PlayerBasic user, PlayerBasic aim) { if (isCooled) { isCooled = false; theAim = aim; damageAll = damageMax; damageSave = 0f; } }