|
@@ -41,6 +41,8 @@ namespace Comp
|
|
|
|
|
|
public int playerId;
|
|
public int playerId;
|
|
|
|
|
|
|
|
+ private bool _startCheckPos = false; // 过了碰撞点再开始检查是否复位
|
|
|
|
+
|
|
private void Start()
|
|
private void Start()
|
|
{
|
|
{
|
|
_animator = GetComponent<Animator>();
|
|
_animator = GetComponent<Animator>();
|
|
@@ -54,13 +56,13 @@ namespace Comp
|
|
private void OnWalk()
|
|
private void OnWalk()
|
|
{
|
|
{
|
|
_thrust = new Vector3(0, 0, MoveSpeed);
|
|
_thrust = new Vector3(0, 0, MoveSpeed);
|
|
|
|
+ Debug.Log("start walk");
|
|
StartCoroutine(CockRayCast());
|
|
StartCoroutine(CockRayCast());
|
|
}
|
|
}
|
|
|
|
|
|
private IEnumerator CockRayCast() // 判断碰撞点,现在不用射线了
|
|
private IEnumerator CockRayCast() // 判断碰撞点,现在不用射线了
|
|
{
|
|
{
|
|
yield return new WaitForSeconds(1f);
|
|
yield return new WaitForSeconds(1f);
|
|
- Debug.Log("lift cock");
|
|
|
|
var actionComp = GameCore.Instance.GetCockActionCompByPlayerId(playerId);
|
|
var actionComp = GameCore.Instance.GetCockActionCompByPlayerId(playerId);
|
|
var cockObj = actionComp.gameObject;
|
|
var cockObj = actionComp.gameObject;
|
|
_cock = cockObj;
|
|
_cock = cockObj;
|
|
@@ -80,16 +82,22 @@ namespace Comp
|
|
if ((transform.forward.x > 0 && transform.position.x <= _initialX) ||
|
|
if ((transform.forward.x > 0 && transform.position.x <= _initialX) ||
|
|
(transform.forward.x < 0 && transform.position.x >= _initialX))
|
|
(transform.forward.x < 0 && transform.position.x >= _initialX))
|
|
{
|
|
{
|
|
- _masterController.Idle();
|
|
|
|
- GameCore.Instance.ReportMasterBack(transform.forward.x > 0);
|
|
|
|
|
|
+ if (_startCheckPos)
|
|
|
|
+ {
|
|
|
|
+ _thrust = Vector3.zero;
|
|
|
|
+ _masterController.Idle();
|
|
|
|
+ _startCheckPos = false;
|
|
|
|
+ GameCore.Instance.ReportMasterBack(transform.forward.x > 0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
transform.Translate(_rThrust * Time.deltaTime);
|
|
transform.Translate(_rThrust * Time.deltaTime);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else if (stateInfo.IsTag("walk"))
|
|
{
|
|
{
|
|
|
|
+ Debug.Log("move speed is " + _thrust);
|
|
transform.Translate(_thrust * Time.deltaTime);
|
|
transform.Translate(_thrust * Time.deltaTime);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -103,6 +111,7 @@ namespace Comp
|
|
if (_collisionX != 0 && transform.position.x >= _collisionX)
|
|
if (_collisionX != 0 && transform.position.x >= _collisionX)
|
|
{
|
|
{
|
|
_thrust = Vector3.zero;
|
|
_thrust = Vector3.zero;
|
|
|
|
+ _startCheckPos = true;
|
|
_masterController.Lift();
|
|
_masterController.Lift();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -111,6 +120,7 @@ namespace Comp
|
|
if (_collisionX != 0 && transform.position.x <= _collisionX)
|
|
if (_collisionX != 0 && transform.position.x <= _collisionX)
|
|
{
|
|
{
|
|
_thrust = Vector3.zero;
|
|
_thrust = Vector3.zero;
|
|
|
|
+ _startCheckPos = true;
|
|
_masterController.Lift();
|
|
_masterController.Lift();
|
|
}
|
|
}
|
|
}
|
|
}
|