// Update is called once per frame void Update() { if (mMoveState == EMoveState.Moving) { if (mMovingTime > Time.deltaTime) { Vector3 targetPos = new Vector3(mTarget.transform.position.x, mTarget.transform.position.y + TargetHeight, mTarget.transform.position.z); transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime / mMovingTime); mMovingTime -= Time.deltaTime; } else { // finished. mMoveState = EMoveState.None; //mTarget.UUnitInfo.UnitTopUI.OnInfoPopup("Soul+" + mSoulValue, UnitTopUI.SoulColor); //mTarget.AddSoul(mSoulValue);//cancel by Lindean 20141031 //mTarget.AddExp(mSoulValue);//mTarget.AddSoul(mSoulValue);//怪物被杀出现的能量小球,增加魂力的,新战斗变成增加能量 if (mOnFinished != null) { mOnFinished(this); } } } }
public void StopMoveForSkill() { if (!Singleton <PvpManager> .Instance.IsInPvp) { if (this.isMoving && this.navAgent != null) { this.navAgent.StopMove(); } } else if ((this.self.isHero || this.self.isPlayer) && this.isMoving) { StopMove data = new StopMove { rotate = this.self.transform.eulerAngles.y, unitId = this.self.unique_id, pos = MoveController.Vector3ToSVector3(this.self.transform.position), tick = UnitsSnapReporter.Instance.SyncTicks }; if (this.self.IsMaster) { PvpEvent.SendStopMove(SerializeHelper.Serialize <StopMove>(data)); } } this.curMoveState = EMoveState.MoveState_Idle; }
public void MoveToEnd() { if (m_MoveState == EMoveState.AtStart) { m_MoveState = EMoveState.ToEnd; } }
public void MoveToStart() { if (m_MoveState == EMoveState.AtEnd) { m_MoveState = EMoveState.ToStart; } }
void Update() { if (m_MoveState == EMoveState.ToEnd) { m_CurrentTime += Time.deltaTime; if (m_CurrentTime >= m_MoveTime) { m_CurrentTime = 0f; m_MoveState = EMoveState.AtEnd; transform.position = m_EndPos.position; } else { transform.position = Vector3.Lerp(m_StartPos.position, m_EndPos.position, m_CurrentTime / m_MoveTime); GetComponent <Interactable>().SetState(EInteractableType.Repairable); } } else if (m_MoveState == EMoveState.ToStart) { m_CurrentTime += Time.deltaTime; if (m_CurrentTime >= m_MoveTime) { m_CurrentTime = 0f; m_MoveState = EMoveState.AtStart; transform.position = m_StartPos.position; } else { transform.position = Vector3.Lerp(m_EndPos.position, m_StartPos.position, m_CurrentTime / m_MoveTime); GetComponent <Interactable>().SetState(EInteractableType.Destructable); } } }
public CMoveController(CNPCEntity pOwner) { m_pOwner = pOwner; m_GameObject = pOwner.gameObject; m_eCurMove = EMoveState.EMS_Stand; m_character = m_GameObject.GetComponent<CharacterController>(); }
void SetMoveState() { moveState = EMoveState.RUNNING; if (InputController.IsSprinting) { moveState = EMoveState.SPRINTING; } if (InputController.IsWalking) { moveState = EMoveState.WALKING; } if (InputController.IsCrouched) { moveState = EMoveState.CROUCHING; } if (InputController.IsCrouched) { moveState = EMoveState.CROUCHING; } if (InputController.IsProneing) { moveState = EMoveState.PRONEING; } }
void SetMoveState() { moveState = EMoveState.RUNNING; if (!GameManager.Instance.LocalPlayer.Movecontroller.isGrounded && InputController.isJumping) { moveState = EMoveState.JUMPING; } if (InputController.isSprinting) { moveState = EMoveState.SPRINTING; } if (InputController.isWalking) { moveState = EMoveState.WALKING; } if (InputController.isCrouched) { moveState = EMoveState.CROUCHING; } if (isInCover) { moveState = EMoveState.COVER; } if (isVaulting) { moveState = EMoveState.VAULTING; } }
void SetMoveState() { MoveState = EMoveState.WALKING; if (InputController.IsRunning) { MoveState = EMoveState.RUNNING; } if (InputController.IsSneaking) { MoveState = EMoveState.SNEAKING; } if (InputController.IsCrouched) { MoveState = EMoveState.CROUCHING; } if (isInCover) { MoveState = EMoveState.COVER; } if (IsFalling) { MoveState = EMoveState.FALLING; } }
//public void Begin(Vector3 pos, int soul, OnFinished onFinished) //{ // transform.position = pos; // mSoulValue = soul; // mTarget = UnitManager.Instance.LocalPlayer; // mMoveState = EMoveState.Rise; // mOnFinished = onFinished; // iTween.MoveTo(gameObject, iTween.Hash( // "y", transform.position.y + RiseHeight, // "time", RiseTime, // "easetype", iTween.EaseType.easeOutCubic, // "oncomplete", "RiseComplete")); //} public void ldaBegin(MeteorUnit attacker, Vector3 pos, int soul, GameObject coin, OnFinished onFinished) { //mCoin = coin; transform.position = pos; mSoulValue = soul; mTarget = attacker; mMoveState = EMoveState.Rise; mOnFinished = onFinished; float rvalue = Random.value * 0.2f; if (Random.Range(0, 10) > 5) { MovingTime += rvalue; } else { MovingTime -= rvalue; } iTween.MoveTo(gameObject, iTween.Hash( "y", transform.position.y, //+ RiseHeight, "time", 0, //RiseTime, "easetype", iTween.EaseType.easeOutCubic, "oncomplete", "RiseComplete")); }
public void StopMove( ) { if (m_pOwner != null && m_pOwner.m_FSM != null) { m_eCurMove = EMoveState.EMS_Stand; m_pOwner.m_FSM.ChangeBeHavior(BehaviorType.EState_Idle, 0); } }
public void StartNPCPursue( Vector3 vDstPos, EMoveState eState ) { if (m_pOwner != null && m_pOwner.m_FSM != null) { m_vDstPosition = vDstPos; m_eCurMove = eState; if (Vector3.Distance(m_GameObject.transform.position, m_vDstPosition) > 0.6f) { m_pOwner.m_FSM.ChangeBeHavior(BehaviorType.EState_Move, 1); } } }
void SetMoveState() { MoveState = EMoveState.Walking; if (InputController.Crouch) { MoveState = EMoveState.Crouching; } if (InputController.Run) { MoveState = EMoveState.Running; } }
void SetMoveState() { MoveState = EMoveState.WALKING; if (InputController.IsRunning) { MoveState = EMoveState.RUNNING; } if (InputController.Jump) { MoveState = EMoveState.JUMPING; } }
public void Begin(Vector3 pos, int soul, OnFinished onFinished) { transform.position = pos; mSoulValue = soul; mTarget = MeteorManager.Instance.LocalPlayer; mMoveState = EMoveState.Rise; mOnFinished = onFinished; iTween.MoveTo(gameObject, iTween.Hash( "y", transform.position.y + RiseHeight, "time", RiseTime, "easetype", iTween.EaseType.easeOutCubic, "oncomplete", "RiseComplete")); }
public void ldaBegin(MeteorUnit attacker, Vector3 pos, int soul, OnFinished onFinished) { transform.position = pos; mSoulValue = soul; mTarget = attacker; mMoveState = EMoveState.Rise; mOnFinished = onFinished; iTween.MoveTo(gameObject, iTween.Hash( "y", transform.position.y + RiseHeight, "time", RiseTime, "easetype", iTween.EaseType.easeOutCubic, "oncomplete", "RiseComplete")); }
public void ResetMoveInfosOnRelive() { this.newLastMoveTime = 0f; this.curTargetPos = base.transform.position; this.nextTargetPos = this.curTargetPos; this.hasNextTargetPos = false; this.newIsMoving = false; this.CurPosition = base.transform.position; this.FinalFacing = base.transform.rotation.eulerAngles.y; this.CurFacing = this.FinalFacing; this.playerPos = base.transform.position; this.curMoveState = EMoveState.MoveState_Idle; this.curMoveStatePos = MoveController.InvalidPos; this.lastServerPos = base.transform.position; this.self.serverPos = base.transform.position; this.PauseMoveInPvp = false; }
/** * 设置移动状态 * */ void SetMoveState() { MoveState = EMoveState.RUNNING; if (InputController.IsWalking) { MoveState = EMoveState.WALKING; } else if (InputController.IsCrouched) { MoveState = EMoveState.CROUCHING; } else if (InputController.IsJumped) { MoveState = EMoveState.JUMPING; } }
private void SetMoveState() { MoveState = EMoveState.RUNING; if (InputController.IsSprinting) { MoveState = EMoveState.SPRINTING; } if (InputController.IsWalking) { MoveState = EMoveState.WALKING; } if (InputController.IsCrouched) { MoveState = EMoveState.CROUCHING; } }
void SetMoveState() { MoveState = EMoveState.RUNNING; if (InputController.IsSprinting) { MoveState = EMoveState.SPRINTING; } if (InputController.IsWalking) { MoveState = EMoveState.WALKING; } if (InputController.isJumping) { MoveState = EMoveState.JUMPING; } }
void SetMoveState() { moveState = EMoveState.RUNNING; if (inputController.isSpriting) { moveState = EMoveState.SPRINTING; } if (inputController.isWalking) { moveState = EMoveState.WALKING; } if (inputController.isCrouched) { moveState = EMoveState.CROUCHING; } }
private void SetMoveState() { MoveState = EMoveState.Running; if (InputController.IsWalking) { MoveState = EMoveState.Walking; } if (InputController.IsCrouching) { MoveState = EMoveState.Crouching; } if (InputController.IsSprinting) { MoveState = EMoveState.Sprinting; } if (IsInCover) { MoveState = EMoveState.Covering; } }
public void StopMove() { if (!Singleton <PvpManager> .Instance.IsInPvp) { if (this.isMoving && this.navAgent != null) { this.navAgent.StopMove(); } } else if ((this.self.isHero || this.self.isPlayer) && this.isMoving) { StopMove stopMove = new StopMove(); stopMove.rotate = this.self.transform.eulerAngles.y; stopMove.unitId = this.self.unique_id; stopMove.pos = MoveController.Vector3ToSVector3(this.self.transform.position); stopMove.tick = UnitsSnapReporter.Instance.SyncTicks; if (this.self.IsMaster) { } } this.curMoveState = EMoveState.MoveState_Idle; }
void setMoveState() { MoveState = EMoveState.RUNNING; if (InputController.isWalking) { MoveState = EMoveState.WALKING; } if (InputController.isSprinting) { MoveState = EMoveState.SPRINTING; } if (InputController.isCrouching) { MoveState = EMoveState.CROUCHING; } if (isInCover) { MoveState = EMoveState.COVER; } }
public void MoveToTarget(Units target, float stopDistance) { if (target != null && this.self.CanMove) { bool flag = false; if (this.curMoveState == EMoveState.MoveState_MoveToTarget) { if (this.curMoveStateTargetId == target.unique_id) { if (DateTime.Now.Ticks - this.lastSearchPath > 5000000L) { flag = true; } } else { flag = true; } } else { flag = true; } if (!flag) { return; } this.curMoveState = EMoveState.MoveState_MoveToTarget; this.curMoveStateTargetId = target.unique_id; this.lastSearchPath = DateTime.Now.Ticks; if (Singleton <PvpManager> .Instance.IsInPvp) { if (this.self.isPlayer || (this.self.MirrorState && this.self.ParentUnit.isPlayer)) { this.self.InterruptAction(SkillInterruptType.Initiative); float num = UnitFeature.DistanceToTarget(this.self.mTransform, target.mTransform); if (num < stopDistance + 3f) { this.m_DistanceToTargetType = DistanceToTargetType.NearByTarget; } else { this.m_DistanceToTargetType = DistanceToTargetType.FarFromTarget; } if (GlobalSettings.Instance.PvpSetting.isPlayerMoveBeforeServer && this.navAgent != null) { this.navAgent.MoveToTarget(target, stopDistance); } this.SendMoveToTarget(target.unique_id, target.transform.position, stopDistance); } } else { this.self.InterruptAction(SkillInterruptType.Initiative); float num2 = UnitFeature.DistanceToTarget(this.self.mTransform, target.mTransform); if (num2 < stopDistance + 3f) { this.m_DistanceToTargetType = DistanceToTargetType.NearByTarget; } else { this.m_DistanceToTargetType = DistanceToTargetType.FarFromTarget; } if (this.navAgent != null) { this.navAgent.MoveToTarget(target, stopDistance); } } } }
public void MoveToPoint(Vector3?targetPoint, float stop_distance, bool forceSearch = false) { if (targetPoint.HasValue && this.self.CanMove) { bool flag = forceSearch; if (!forceSearch) { if (this.curMoveState == EMoveState.MoveState_MoveToPos) { if ((double)Vector3.Dot(targetPoint.Value - this.self.transform.position, this.self.transform.forward) < 0.7) { flag = true; } else { float num = (this.curMoveStatePos - targetPoint.Value).Magnitude2D(); float num2 = num / (this.self.transform.position - targetPoint.Value).Magnitude2D(); if ((double)num2 < 0.04 || num < 16f) { this.curMoveStatePos_Stash = targetPoint.Value; } else { flag = true; } } } else { flag = true; } } if (!flag) { return; } this.curMoveState = EMoveState.MoveState_MoveToPos; this.curMoveStatePos = targetPoint.Value; this.lastSearchPath = DateTime.Now.Ticks; this.curMoveStatePos_Stash = MoveController.InvalidPos; if (Singleton <PvpManager> .Instance.IsInPvp) { if (GlobalSettings.Instance.PvpSetting.isPlayerMoveBeforeServer && this.self.isPlayer) { if (this.navAgent != null) { this.navAgent.MoveToPoint(targetPoint, stop_distance); } this.self.InterruptAction(SkillInterruptType.Initiative); this.self.PlayAnim(AnimationType.Move, true, 0, true, false); } if (this.self.isPlayer || (this.self.MirrorState && this.self.ParentUnit.isPlayer)) { if (MoveController.ShowMoveDelay) { MoveController.TestMoveOrderTime = Stopwatch.GetTimestamp(); } this.SendMoveToPos(targetPoint.Value, stop_distance); } } else { this.self.InterruptAction(SkillInterruptType.Initiative); if (this.navAgent != null) { this.navAgent.MoveToPoint(targetPoint, stop_distance); } } } }
public void FlyStart() { mMoveState = EMoveState.Flying; }
void RiseComplete() { mMovingTime = MovingTime; mMoveState = EMoveState.Moving; }
// Update is called once per frame void Update() { if (_debug_update_info) { _debug_update_info = false; _raiseing_its_y_time = _raise_its_y_time; _going_center_time = _go_center_time; _cur_radius_length = _radius_length; float rvalue = Random.value * 0.2f; if (Random.Range(0, 10) > 5) { _raiseing_its_y_time += rvalue; _going_center_time += rvalue; _cur_radius_length += rvalue; } else { _raiseing_its_y_time -= rvalue; _going_center_time -= rvalue; _cur_radius_length -= rvalue; } //if (_arrived_effect != null) // _arrived_effect.SetActive(false); } //if (Input.GetKeyUp(KeyCode.Z)) //{ // ObjectXZFaceToTarget(this.gameObject, _center_object); // //ldaBegin(null, transform.position, delegate(AbsorbDropThings dropthing) // //{ // // ////UnitManager.Instance.DestroyCoin(ball.mCoin); // // ////GameObject.DestroyImmediate(ball.gameObject); // //}); //} //if (Input.GetKeyUp(KeyCode.X)) //{ // mMoveState = EMoveState.Rounding; //} //if (Input.GetKeyUp(KeyCode.C)) //{ // mMoveState = EMoveState.None; // _debug_update_info = true; //} if (mMoveState == EMoveState.Flying) { //if (!_center_object.activeSelf) // _center_object.SetActive(true); if (_flying_to_target_time > Time.deltaTime) { Vector3 targetPos = Vector3.zero; if (_center_object != null) { targetPos = new Vector3(_center_object.transform.position.x, _center_object.transform.position.y + _fly_to_target_height, _center_object.transform.position.z); } transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime / _flying_to_target_time); _flying_to_target_time -= Time.deltaTime; transform.Rotate(Time.deltaTime * _fly_rotation_value.x * _fly_rotation_speed, Time.deltaTime * _fly_rotation_value.y * _fly_rotation_speed, Time.deltaTime * _fly_rotation_value.z * _fly_rotation_speed, (_fly_rotation_world_space ? Space.World : Space.Self)); } else { mMoveState = EMoveState.None; //transform.rotation = Quaternion.identity; Vector3 rEulerAngles = transform.rotation.eulerAngles; rEulerAngles.x = 0; rEulerAngles.z = 0; transform.rotation = Quaternion.Euler(rEulerAngles); //if (this.gameObject.activeSelf) // this.gameObject.SetActive(false); //if (_arrived_effect != null) // _arrived_effect.SetActive(true); //if (_toptip_effect != null) // _toptip_effect.SetActive(true); _arrived_effect = GameObject.Instantiate(Resources.Load(_arrived_effect_name), Vector3.zero, Quaternion.identity) as GameObject; _arrived_effect.transform.parent = this.transform; _arrived_effect.transform.localPosition = Vector3.zero; _arrived_effect.transform.localRotation = Quaternion.identity; _arrived_effect.transform.localScale = Vector3.one; _arrived_effect.transform.parent = null;//调整好位置后放到世界坐标去,不和物品一起消失 //if (_arrived_effect != null) // _arrived_effect.SetActive(false); _toptip_effect = GameObject.Instantiate(Resources.Load(_toptip_effect_name), Vector3.zero, Quaternion.identity) as GameObject; _toptip_effect.transform.parent = this.transform; _toptip_effect.transform.localPosition = Vector3.zero; _toptip_effect.transform.localRotation = Quaternion.identity; _toptip_effect.transform.localScale = Vector3.one; _toptip_effect.transform.parent = null;//调整好位置后放到世界坐标去,不和物品一起消失 //if (_toptip_effect != null) // _toptip_effect.SetActive(false); if (mOnFinished != null) { mOnFinished(this); } } return; } //if (mMoveState == EMoveState.Rounding) //{ // //if (!_center_object.activeSelf) // // _center_object.SetActive(true); // if (_raise_its_y) // { // if (_raiseing_its_y_time > 0) // { // Vector3 targetPos = _center_object.transform.position;//_center_pos; // if (_center_object != null) // targetPos = new Vector3(_center_object.transform.position.x, _center_object.transform.position.y + _raise_its_y_distance, _center_object.transform.position.z); // transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime / _raiseing_its_y_time); // Debug.Log("_raise_its_y_distance " + _raise_its_y_distance); // _raiseing_its_y_time -= Time.deltaTime; // } // } // if (_go_center) // { // if (_going_center_time > 0) // { // _cur_radius_length = Mathf.Lerp(_cur_radius_length, _radius_length - _go_center_distance, Time.deltaTime / _going_center_time); // _going_center_time -= Time.deltaTime; // } // } // if (_always_face_to_center && _center_object != null) // { // ObjectXZFaceToTarget(this.gameObject, _center_object); // } // temp_angle += _angle_speed * Time.deltaTime; // // //_pos_new.x = _center_pos.x + Mathf.Cos(temp_angle) * _cur_radius_length; // //_pos_new.y = _center_pos.y + Mathf.Sin(temp_angle) * _cur_radius_length; // //_pos_new.z = transform.localPosition.z; // _pos_new.x = _center_object.transform.position.x + Mathf.Cos(temp_angle) * _cur_radius_length; // _pos_new.y = transform.localPosition.y; // _pos_new.z = _center_object.transform.position.y + Mathf.Sin(temp_angle) * _cur_radius_length; // transform.localPosition = _pos_new; // //debug // if (_raise_its_y && _go_center && _raiseing_its_y_time <= 0 && _going_center_time <= 0) // { // // //自动跳转到吸取 // // ObjectXZFaceToTarget(this.gameObject, _center_object); // // ldaBegin(null, transform.position, delegate(AbsorbDropThings dropthing) // // { // // ////UnitManager.Instance.DestroyCoin(ball.mCoin); // // ////GameObject.DestroyImmediate(ball.gameObject); // // }); // mMoveState = EMoveState.Flying; // } // return; //} }
public void SetMoveState(EMoveState moveState) { MoveState = moveState; AdjustSpeed(); }