void OnClickInteractiveObj(InteractiveObj obj) { if (ControlTeam && obj.IsEnemy(Camp)) { ControlTeam.AttackTarget(obj); } }
protected override void OnExecute(InteractiveObj self, InteractiveObj target) { if (target.IsEnemy(self.Camp)) { target.Camp = self.Camp; SceneObjHeadInfo info = target.UIHeadInfo; if (info) { if (self.Camp == Common.MyselfCamp) { info.txtBlood.color = Color.green; info.sldBlood.fillRect.GetComponent <UnityEngine.UI.Graphic>().color = Color.green; DrawAttackRange draw = target.GetComponent <DrawAttackRange>(); if (draw) { draw.bNeedUpdate = false; } LineRenderer line = target.GetComponent <LineRenderer>(); if (line) { line.enabled = false; } } else { info.txtBlood.color = Color.red; info.sldBlood.fillRect.GetComponent <UnityEngine.UI.Graphic>().color = Color.red; } } self.DoDamage(new Damage(WorldSetting.Effect.Dark, 5), WorldInteractObj.Instance); } }
private void OnCollisionEnter(Collision collision) { if (Master.bCanUseJumpSkill) { InteractiveObj target = collision.collider.GetComponent <InteractiveObj>(); if (target && target.IsAlive && target.IsEnemy(Master.Camp)) { Vector3 myCenter = Master.ColliderSelf.bounds.center; Vector3 center = target.ColliderSelf.bounds.center; float top = target.ColliderSelf.bounds.max.y; if (top - Master.ColliderSelf.bounds.min.y < 0.1f) { float y = center.y; center.y = myCenter.y; myCenter.y = y; if (Master.ColliderSelf.bounds.Contains(center) || target.ColliderSelf.bounds.Contains(myCenter)) { target.DoDamage(new Damage(WorldSetting.Effect.Physical, 1000000), Master); Master.Body.RigidSelf.AddForce(0, 500, 0, ForceMode.Impulse); return; } } } } OnTrigger(collision.collider); }
public void AddFightingEnemey(InteractiveObj obj) { if (obj && obj.IsEnemy(Camp) && !obj.WillNotBeFind) { dicFightingObjs[obj.ID] = obj; } }
protected override void OnExecute(InteractiveObj self, Vector3 pos) { foreach (var target in BattleManager.Instance.dicInteractiveObjs.Values) { if (target && self.IsEnemy(target.Camp) && Common.IsPosInConeRange(self.transform, pos, Angle, MaxRange, MinRange)) { target.DoDamage(new Damage(EffectType, self.CalAtkDamage(EffectBaseValue)), self); } } }
public void OnTrigger(Collider other) { if (!Master.IsAlive || !BattleManager.Instance.IsBattleBegin) { return; } Q_SceneObj sceneObj = other.GetComponent <Q_SceneObj>(); if (sceneObj) { switch (sceneObj.objType) { case Q_SceneObj.Type.Skill: SkillEffectBase[] skillEffects = sceneObj.GetComponentsInChildren <SkillEffectBase>(true); for (int i = 0, length = skillEffects.Length; i < length; ++i) { skillEffects[i].Execute(WorldInteractObj.Instance, Master); } sceneObj.UseObj(); break; case Q_SceneObj.Type.GuidePoint: sceneObj.UseObj(); UISystem.Instance.ShowGuideDialog(sceneObj.name); break; case Q_SceneObj.Type.TriggerPoint: sceneObj.UseObj(); break; case Q_SceneObj.Type.LoadScene: sceneObj.UseObj(); GameClient.Instance.LoadScene(sceneObj.strNeedItemName); break; case Q_SceneObj.Type.Vedio: VedioPlayer.Play(sceneObj.strNeedItemName, null); sceneObj.gameObject.SetActive(false); sceneObj.UseObj(); break; case Q_SceneObj.Type.SuccessPoint: sceneObj.UseObj(); BattleManager.Instance.BattleOver(true); break; } } InteractiveObj target = other.GetComponent <InteractiveObj>(); if (target && target.IsAlive && target.IsEnemy(ThirdPersonPlayer.Instance.Camp)) { ThirdPersonPlayer.Instance.DoDamage(new Damage(WorldSetting.Effect.Physical, 1), target); } }
protected override void OnExecute(InteractiveObj self, Vector3 pos) { RaycastHit[] hits = Physics.SphereCastAll(pos, Range, Vector3.up, float.MaxValue, layerEnemey); for (int i = 0, length = hits.Length; i < length; ++i) { InteractiveObj target = hits[i].collider.GetComponent <InteractiveObj>(); if (target && self.IsEnemy(target.Camp)) { target.DoDamage(new Damage(EffectType, self.CalAtkDamage(EffectBaseValue)), self); } } }
protected InteractiveObj FindTargetByPos(InteractiveObj self, Vector3 pos, int range = DefaultEffectRange) { RaycastHit[] hits = Physics.SphereCastAll(pos, range, Vector3.up, float.MaxValue, layerEnemey); for (int i = 0, length = hits.Length; i < length; ++i) { InteractiveObj target = hits[i].collider.GetComponent <InteractiveObj>(); if (target && self.IsEnemy(target.Camp)) { return(target); } } return(null); }
void OnTrigger(Collider other) { if (!BattleManager.Instance.IsBattleBegin) { return; } switch (objType) { case Type.Skill: InteractiveObj target = other.GetComponent <InteractiveObj>(); if (!target || target == ThirdPersonPlayer.Instance || !target.IsEnemy(ThirdPersonPlayer.Instance.Camp)) { return; } SkillEffectBase[] skillEffects = GetComponentsInChildren <SkillEffectBase>(true); for (int i = 0, length = skillEffects.Length; i < length; ++i) { skillEffects[i].Execute(WorldInteractObj.Instance, target); } UseObj(); break; case Type.TriggerPoint: Q_SceneObj obj = other.GetComponent <Q_SceneObj>(); if (obj && obj.objType == Type.PickUpItem) { UseObj(); } break; case Type.PickUpItem: Rigidbody body = GetComponent <Rigidbody>(); if (body && body.velocity.sqrMagnitude > 0.9f) { UseObj(); } break; } }
protected override CastResult OnCast() { for (int i = 0, length = Random.Range(MissleMinCount, MissleMaxCount + 1); i < length; ++i) { if (ReleaseFX) { EffectPlayer.PlayOnTransform(ReleaseFX, ReleaseFXPoint); } if (ReleaseSE) { AudioSystem.Instance.PlayOnTransform(ReleaseSE, ReleaseFXPoint); } Missle missle = Instantiate(MisslePrefab, transform.position, transform.rotation).GetOrAddComponent <Missle>(); switch (LockType) { case SkillLockType.Position: switch (MissleType) { case Type.Bullet: missle.InitBullet(TargetPos, MissileSpeed, Settlement); break; default: missle.Init(TargetPos, MissileSpeed, Settlement); break; } break; case SkillLockType.NoLock: switch (MissleType) { case Type.Bullet: //missle.InitBullet(TargetPos, MissileSpeed, Settlement); break; default: missle.gameObject.AddComponent <SphereCollider>().isTrigger = true; missle.gameObject.AddComponent <Rigidbody>().isKinematic = true; missle.InitFlyFront(Master.transform.forward, MissileSpeed, SkillMaxRange, (hitObj, missleScript) => { if (hitObj) { InteractiveObj target = hitObj.GetComponent <InteractiveObj>(); if (target) { if (target.IsAlive && target.IsEnemy(Master.Camp)) { Settlement(target); Destroy(missleScript.gameObject); } return; } Q_SceneObj sceneObj = hitObj.GetComponent <Q_SceneObj>(); if (sceneObj) { switch (sceneObj.objType) { case Q_SceneObj.Type.Skill: case Q_SceneObj.Type.Item: case Q_SceneObj.Type.NeedItem: break; default: return; } } } if (HitFX) { EffectPlayer.PlayAtPos(HitFX, missleScript.transform.position); } if (HitSE) { AudioSystem.Instance.PlayAtPos(HitSE, missleScript.transform.position); } missleScript.Alive = false; Destroy(missleScript.gameObject); }); break; } break; default: if (Target) { missle.Init(Target.transform, MissileSpeed, (tsf) => Settlement(tsf.GetComponent <InteractiveObj>())); } else { missle.Init(TargetPos, MissileSpeed, Settlement); } break; } missle.SetLifeTime(MissleLifeTime); if (FlySE) { AudioSystem.Instance.PlayOnTransform(FlySE, missle.transform); } } return(CastResult.Success); }