public override void Hit(Acter Target) //남을 때릴때 { Target.HChacter.HeathDamage(haveCharacter.Attack); UIWarManager.SetAmountChange(Target.HChacter); UIWarManager.instance.ShowDamageText(Target.transform.position, haveCharacter.Attack); Target.StartHitEffect(navMeshObject.position); }
public Acter theThis; //自己 //获得必要的数据 public void makeState(NavMeshAgent theMoveControllerIn, Animator theAnimatorIn, Acter thisIn, Acter AimIn) { theMoveController = theMoveControllerIn; theAnimator = theAnimatorIn; theAim = AimIn; theThis = thisIn; }
/// <summary> /// 所有的任务在这里统一检测击杀事件 /// </summary> /// <param name="theAim">The aim.</param> private void OnKill(Acter theAim) { for (int i = 0; i < theMissions.Count; i++) { theMissions [i].OnPlayerKill(theAim); } }
// Update is called once per frame void Update() { //ポーズの時に止める if (Time.timeScale <= 0) { return; } if (hp.Hp <= 0) { return; } switch (act) { case Acter.Start: if (GameObject.FindGameObjectWithTag("Boss").GetComponent <BossFirstAction>().action == BossFirstAction.MoveAction.End) { act = Acter.Attack; } break; case Acter.Attack: if (Cnt == 480) { if (GetComponent <BossHp>().GetHp() >= GetComponent <BossHp>().GetMaxHp() / 6) { for (int x = 0; x < 2; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet3(transform.position, 1); } } if (GetComponent <BossHp>().GetHp() < GetComponent <BossHp>().GetMaxHp() / 6 && GetComponent <BossHp>().GetHp() >= GetComponent <BossHp>().GetMaxHp() / 3) { for (int x = 0; x < 4; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet3(transform.position, 1); } } if (GetComponent <BossHp>().GetHp() < GetComponent <BossHp>().GetMaxHp() / 3) { for (int x = 0; x < 6; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet3(transform.position, 1); } } for (int x = 0; x < 3; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet4(transform.position, 1); } audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet(transform.position, 1); Cnt = 0; } Cnt++; break; } }
// Start is called before the first frame update void Start() { hp = gameObject.GetComponent <BossHp>(); act = Acter.Start; audioSource = GetComponent <AudioSource>(); SECharge = false; }
/// <summary> ///击杀方法包装 /// </summary> /// <param name="aim">Aim.</param> public void OnKill(Acter aim) { if (KillEvent != null) { KillEvent(aim); } }
private void SearchAim() { if (theAim && theAim.isAlive && Vector3.Distance(theAim.transform.position, this.thePlayer.transform.position) < searchDistance) { this.thePlayer.theMoveController.MakeLookAt(theAim.transform); } else { Collider[] attackAims = Physics.OverlapSphere(this.thePlayer.transform.position, searchDistance); Acter aAim = null; float distance = 999f; for (int i = 0; i < attackAims.Length; i++) { Acter thePlayerGet = attackAims [i].GetComponent <Acter> (); if (!thePlayerGet || thePlayerGet == this.thePlayer || !thePlayerGet.isAlive) { continue; } float distanceNew = Vector3.Distance(this.thePlayer.transform.position, attackAims [i].transform.position); if (distanceNew < distance) { distance = distanceNew; aAim = thePlayerGet; } } if (aAim) { theAim = aAim; this.thePlayer.theMoveController.MakeLookAt(theAim.transform); } } }
void SkillParticleSet(Acter targetacter) { skillParticle temp = new skillParticle(); temp.Particle = (GameObject)Instantiate(nowSkill.Particle, targetacter.transform); temp.Index = nowSkill.SkillIndex; targetacter.SkillParticleSet(temp); }
// Start is called before the first frame update void Start() { hp = gameObject.GetComponent<BossHp>(); act = Acter.Start; audioSource = GetComponent<AudioSource>(); option = GameObject.Find("Option"); optionscript = option.GetComponent<Option>(); Cnt2 = 0; SECharge = false; }
void OnTriggerEnter(Collider collisioner) { Acter playeraim = collisioner.GetComponent <Acter> (); if (playeraim && this.thePlayer && playeraim != this.thePlayer) { //print ("触发攻击"); this.thePlayer.OnAttack(playeraim, extraDamage); } }
void searchAIMs() //不使用射线而是使用向量计算方法 { searchTimer -= Time.deltaTime; if (searchTimer < 0) { searchTimer = searchTimerMax; theEMYGet = SystemValues.searchAIMs(theViewAreaAngel, theSearchLength, this.theMoveController.transform); theMainEMY = getMainEMY(); } }
public override void OnPlayerKill(Acter aim) { if (aim.playerName == "骷髅魔兵") { CountUse++; missionInformation = "骷髅魔兵竟然出现在这里,实在蹊跷。先击溃这些魔兵再做查看。此任务需击杀5只骷髅魔兵方可完成。已击杀:" + CountUse + "/" + CountUseMax; if (checkMissionOver()) { OnMissionOver(); } } }
protected virtual void TargetSet(Acter _target) { if (_target == Target) { return; } if (_target.HChacter.Life == DeadorLive.LIVE) { Target = _target; TargetView(); } }
/// <summary> /// 攻击的时候触发 /// 触发方式可以是动画事件也可能是投掷武器 /// 这个方式会计算额外的伤害 /// </summary> /// <param name="aim">Aim.</param> public virtual void OnAttack(Acter aim, float extraDamage = 0f) { if (!aim.isAlive) { return; } aim.OnHpChange(-(this.attackDamage + extraDamage)); if (aim.hpNow == 0) { OnKill(aim); } }
//找到的目标很多,排序找到最终的目标 private Acter getMainEMY() { //Debug.Log ("first check count = "+ theEMYGet.Count); for (int i = 0; i < theEMYGet.Count; i++) { Acter thePlayer = theEMYGet [i].GetComponent <Acter> (); if (!theEMYGet [i].tag.Equals("AI") && thePlayer && thePlayer.isAlive) { return(thePlayer); } } return(null); }
public override void OnAttack(Acter aim, float extreaDamage) { if (!aim.isAlive) { return; } aim.OnHpChange(-(this.attackDamage + extreaDamage)); if (aim.hpNow == 0) { OnKill(aim); OnGetLearningValue(aim.lvNow * 15f); } }
//初始化 void Start() { this.transform.root.tag = "AI"; //打上标记方便找 thethis = this.GetComponent <Acter> (); theMoveController = this.GetComponentInChildren <NavMeshAgent> (); theAnimator = this.GetComponentInChildren <Animator> (); theStateNow = new FSM_Search(); theStateNow.makeState(theMoveController, theAnimator, thethis, null); theStateNow.setArea(attackarea, searchArea); theStateNow.OnFSMStateStart(); this.enabled = false; }
// Update is called once per frame void Update() { //ポーズの時に止める if (Time.timeScale <= 0) { return; } if (hp.Hp <= 0) { return; } switch (act) { case Acter.Start: if (GameObject.FindGameObjectWithTag("Boss").GetComponent <BossFirstAction>().action == BossFirstAction.MoveAction.End) { act = Acter.Attack; } break; case Acter.Attack: if (Cnt * Time.deltaTime > 1) { for (int x = 0; x < 10; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet2(transform.position, 0); } Cnt = 0; Cnt2++; } if (Cnt2 > 5) { for (int x = 0; x < 3; x++) { audioSource.PlayOneShot(BulletSE); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet4(transform.position, 1); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet(transform.position, 1); } audioSource.PlayOneShot(BulletSE); // GameObject.FindGameObjectWithTag("Boss").GetComponent<BossBulletManager>().FBulletFactory[0].CreateBullet5(transform.position, 3); GameObject.FindGameObjectWithTag("Boss").GetComponent <BossBulletManager>().FBulletFactory[0].CreateBullet3(transform.position, 3); GetComponent <BossMove>().action = BossMove.MoveAction.Action1; Cnt2 = 0; } Cnt++; break; } }
void OptionChange() { UIWarManager.instance.PushHpBar(this); switch (nowActor.tag) { case "Monster": MonsterActor tempMonster = (MonsterActor)nowActor; tempMonster.SetHpBarExist = false; nowActor = null; tempMonster = null; break; default: break; } }
//初始设定与刷新 public void MakeFkash(Acter thePlayerIn) { SystemValues.bloodCamvasList.Add(this); this.thePlayer = thePlayerIn; this.thePlayer.HpChanger += ChangeSlider; ChangeSlider(0f); if (this.thePlayer.gameObject == SystemValues.thePlayer) { theSliderFront.color = Color.green; } else { theSliderFront.color = Color.red; } }
public void SetBattleCharacter(Acter _setChar) { if (!gameObject.activeSelf) { gameObject.SetActive(true); } if (nowActor == _setChar) { return; } nowActor = _setChar; minValue = 0; maxValue = nowActor.HChacter.MHeath; currentValue = maxValue; barText.text = string.Format("{0}", currentValue); }
protected override void TargetSet(Acter _target) { if (_target == Target) { return; } //플레이어가 나(몬스터)를 인식했으면 HPBar On if (haveCharacter.Life == Sang.DeadorLive.LIVE) { if (isHpBarExist == false) { UIWarManager.instance.HpBarReceiver(this); isHpBarExist = true; } } Target = _target; //Attackwork(); }
void MoveToAttack() { if (attackEnable == true) { NavMove(Target.ActorTransform.position); if (navMesh.remainingDistance <= navMesh.stoppingDistance) { if (Target.HChacter.Life == DeadorLive.LIVE) { Attack(); } else { Target = null; } } } else if (attackEnable == false) { AttackEnd(); } }
public void HpBarReceiver(Acter _actor) { if (barList.Count <= 0) { GameObject temp = Instantiate(HpBarPrefab); UIHpBar tempBar = temp.GetComponent <UIHpBar>(); temp.transform.SetParent(HpBarCollecter); temp.SetActive(true); tempBar.SetBattleCharacter(_actor); tempBar.AddEvent(); return; } else if (barList.Count > 0) { UIHpBar tempBar = barList[0]; tempBar.gameObject.SetActive(true); tempBar.SetBattleCharacter(_actor); barList.Remove(tempBar); tempBar.AddEvent(); return; } }
void SkillParticleActive(Acter targetacter) { targetacter.haveParticlePlay(nowSkill.SkillIndex); }
public virtual void Hit(Acter Target) //남을 때릴때 { Target.HChacter.HeathDamage(haveCharacter.Attack); UIWarManager.SetAmountChange(Target.HChacter); Target.HitAni(); }
public void PartyTargetSet(Acter _target) { PurposeEvent(_target); }
public Player thePlayer; //是哪一个玩家的任务 public virtual void OnPlayerKill(Acter aim) { } //击杀任务用这个方法处理
public void SetActor(int index, Acter _actor) { FriendActer[index] = _actor; }