static public void PlaceOnGround(DDUnitBase unit, Vector3 position) { NavMeshHit hit; NavMesh.SamplePosition(position, out hit, float.PositiveInfinity, DDDefine.AreaAll); unit.TM.position = hit.position; if (unit.Agent.isOnNavMesh == false) { unit.Agent.enabled = false; unit.Agent.enabled = true; } }
public static float GetSqrDistFromUnitToUnit(this DDUnitBase unit1, DDUnitBase unit2) { return((unit1.TM.position - unit2.TM.position).sqrMagnitude); }