public static void MoveTo(this PeEntity entity, Vector3 dst) { Motion_Move mm = entity.GetCmpt <Motion_Move>(); if (mm == null) { return; } mm.MoveTo(dst); }
public static void MoveTo(this PeEntity entity, Vector3 dest, float stopDistance, float speed) { Motion_Move mm = entity.GetCmpt <Motion_Move>(); if (mm == null) { return; } mm.SetSpeed(speed); mm.MoveTo(dest); }
public void MoveToPosition(Vector3 pos, SpeedState speed = SpeedState.Walk) { foreach (PeEntity skEntity in m_Entities) { if (skEntity != null && !skEntity.IsDeath()) { Motion_Move mover = skEntity.GetComponent <Motion_Move>(); if (mover != null && Leader != null) { PeTrans tr1 = mover.GetComponent <PeTrans>(); PeTrans tr2 = Leader.GetComponent <PeTrans>(); if (tr1 != null && tr2 != null) { float r = 3 * Random.value * Mathf.Max(1.0f, Mathf.Max(tr1.radius, tr2.radius)); mover.MoveTo(pos + (tr1.position - tr2.position).normalized * r, speed); } } } } }