public float m_RollWhat = 0.5f; //翻滚冷却 // Use this for initialization void Start() { //获取主相机 m_Cam = Camera.main.transform; m_Cam.transform.position = new Vector3(transform.position.x, transform.position.y + 25, transform.position.z - 8); m_Cam.transform.rotation = Quaternion.Euler(70, 0, 0); //获取第三人称移动脚本 m_Charachter = GetComponent <LocalPlayerCharacter>(); }
public bool HandleMounting(Vector3 target) { if (!_localPlayerCharacterView.IsMounted) { LocalPlayerCharacter localPlayer = _localPlayerCharacterView.LocalPlayerCharacter; if (localPlayer.GetIsMounting()) { return(false); } var mount = _client.GetEntities <MountObjectView>(m => m.IsInUseRange(localPlayer)).FirstOrDefault(); if (mount != null) { if (target != Vector3.zero && mount.IsInUseRange(localPlayer)) { return(true); } if (mount.IsInUseRange(localPlayer)) { _localPlayerCharacterView.Interact(mount); } else { _localPlayerCharacterView.MountOrDismount(); } } else { //Not yet working. Meant to make character walk home if mount is broken. //if (_localPlayerCharacterView.GetLocalPlayerCharacter().IsMountBroken()) //return false; _localPlayerCharacterView.MountOrDismount(); } return(false); } return(true); }
public bool HandleMounting(Vector3 target) { if (!_localPlayerCharacterView.IsMounted) { LocalPlayerCharacter localPlayer = _localPlayerCharacterView.LocalPlayerCharacter; if (localPlayer.GetIsMounting()) { return(false); } var mount = _client.GetEntities <MountObjectView>(m => m.IsInUseRange(localPlayer)).FirstOrDefault(); if (mount != null) { if (target != Vector3.zero && mount.IsInUseRange(localPlayer)) { return(true); } if (mount.IsInUseRange(localPlayer)) { _localPlayerCharacterView.Interact(mount); } else { _localPlayerCharacterView.MountOrDismount(); } } else { _localPlayerCharacterView.MountOrDismount(); } return(false); } return(true); }
public void Fight() { if (_localPlayerCharacterView.IsMounted) { Core.Log("Player Mounted. Dismount now."); _localPlayerCharacterView.MountOrDismount(); return; } if (_combatCooldown > 0 || _localPlayerCharacterView.bIsChanneling()) { Core.LogOnce("Combat Cooldown > 0. Player is channeling: " + _localPlayerCharacterView.bIsChanneling()); _combatCooldown -= UnityEngine.Time.deltaTime; return; } _combatPlayer = _localPlayerCharacterView.GetLocalPlayerCharacter(); _combatTarget = _localPlayerCharacterView.GetAttackTarget(); _combatSpells = _combatPlayer.GetSpellSlotsIndexed().Ready(_localPlayerCharacterView).Ignore("ESCAPE_DUNGEON").Ignore("PLAYER_COUPDEGRACE").Ignore("AMBUSH"); if (_localPlayerCharacterView.IsCasting() || _combatPlayer.GetIsCasting()) { Core.Log("You are casting. Wait for casting to finish"); return; } if (_combatTarget != null && !_combatTarget.IsCasting()) { //Ignore the Spell Interrupt to have it up if needed! _combatSpells = _combatSpells.Ignore("INTERRUPT"); } else { //if Interrupt Spell is useable use it to interrupt the cast and dont run like a pussy and die. if (_combatTarget != null && _combatTarget.IsCasting() && _combatSpells.First().GetSpellDescriptor().TryGetName() == "INTERRUPT2") { Core.Log("Interrupt ready. Use it!"); } else if (_combatTarget != null && _combatTarget.IsCasting()) { Core.Log("Running away from Spell"); // Choose a random point behind Player. Vector3 back = _localPlayerCharacterView.transform.forward * 15f; float randAngle = UnityEngine.Random.Range(-75f, 75f); back = Quaternion.AngleAxis(randAngle, Vector3.up) * back; Vector3 randPos = back + _localPlayerCharacterView.transform.position; _localPlayerCharacterView.StopAnyActionObject(); _localPlayerCharacterView.RequestMove(randPos); _combatCooldown = 0.3f; } } if (_combatCooldown > 0 || _localPlayerCharacterView.bIsChanneling()) { Core.LogOnce("Combat Cooldown > 0. Player is channeling: " + _localPlayerCharacterView.bIsChanneling()); _combatCooldown -= UnityEngine.Time.deltaTime; return; } if (_combatTarget != null && !_combatTarget.IsDead() && SpellPriorityList.Any(s => TryToCastSpell(s.Item1, s.Item2, s.Item3))) { return; } if (_localPlayerCharacterView.IsUnderAttack(out FightingObjectView attacker)) { Core.LogOnce("You are under attack. Attack the attacker"); _localPlayerCharacterView.SetSelectedObject(attacker); _localPlayerCharacterView.AttackSelectedObject(); return; } if (_combatPlayer.GetIsCasting()) { Core.Log("You are casting. Wait for casting to finish"); return; } if (_combatPlayer.GetHealth().GetValue() < (_combatPlayer.GetHealth().GetMaximum() * 0.8f)) { Core.LogOnce("Health below 80%"); var healSpell = _combatSpells.Target(SpellTarget.Self).Category(SpellCategory.Heal); if (healSpell.Any()) { Core.Log("Cast heal spell on self"); _localPlayerCharacterView.CastOnSelf(healSpell.FirstOrDefault().Slot); } return; } _currentTarget = null; _harvestPathingRequest = null; Core.Log("[Eliminated]"); _state.Fire(Trigger.EliminatedAttacker); }
public void Fight() { if (_localPlayerCharacterView.IsMounted) { _localPlayerCharacterView.MountOrDismount(); return; } if (_combatCooldown > 0) { _combatCooldown -= UnityEngine.Time.deltaTime; return; } //Core.Log($" Game Time Now {GameTimeStamp.Now.ToString()}"); //Core.Log($" Cast End Time {castEnd.ToString()}"); //Core.Log($" Cast2 End Time {castEnd2.ToString()}"); //Core.Log($" Cast start Time {castStart1.ToString()}"); //Core.Log($" Cast2 start Time {castStart2.ToString()}"); //Core.Log($"{castEnd2.CompareTo(GameTimeStamp.Now)}"); //if (castEnd2.CompareTo(GameTimeStamp.Now) == 1) //{ // Core.Log("Channelling"); // return; //} _combatPlayer = _localPlayerCharacterView.GetLocalPlayerCharacter(); _combatTarget = _localPlayerCharacterView.GetAttackTarget(); _combatSpells = _combatPlayer.GetSpellSlotsIndexed().Ready(_localPlayerCharacterView).Ignore("ESCAPE_DUNGEON").Ignore("PLAYER_COUPDEGRACE").Ignore("AMBUSH"); foreach (var cs in _combatSpells) { // Core.Log($"{cs.GetSpellDescriptor().TryGetName()}"); //Core.Log($"{cs.GetSpellDescriptor().TryGetTarget()}"); //Core.Log($"{cs.GetSpellDescriptor().TryGetCategory()}"); } if (_combatTarget != null && !_combatTarget.IsDead() && SpellPriorityList.Any(s => TryToCastSpell(s.Item1, s.Item2, s.Item3))) { return; } if (_localPlayerCharacterView.IsUnderAttack(out FightingObjectView attacker)) { _localPlayerCharacterView.SetSelectedObject(attacker); _localPlayerCharacterView.AttackSelectedObject(); return; } // if (GameTimeStamp.Now < channelEnd) // Core.Log($"{GameTimeStamp.Now.ToString()}"); if (_combatPlayer.GetIsCasting()) { return; } if (_combatPlayer.GetHealth().GetValue() < (_combatPlayer.GetHealth().GetMaximum() * 0.8f)) { var healSpell = _combatSpells.Target(SpellTarget.Self).Category(SpellCategory.Heal); if (healSpell.Any()) { _localPlayerCharacterView.CastOnSelf(healSpell.FirstOrDefault().Slot); } return; } _currentTarget = null; _harvestPathingRequest = null; Core.Log("[Eliminated]"); _state.Fire(Trigger.EliminatedAttacker); }
public static SimulationObject GetSimulationObject(this LocalPlayerCharacter localPlayer) => localPlayer.Internal;
public static WorldObject GetWorldObject(this LocalPlayerCharacter localPlayer) => localPlayer.Internal;
public static MovingObject GetMovingObject(this LocalPlayerCharacter localPlayer) => localPlayer.Internal;
public static FightingObject GetFightingObject(this LocalPlayerCharacter localPlayer) => localPlayer.Internal;