void OnCollisionStay(Collision col) { if (AIPath.target != null) { if (col.gameObject.name == "Bot" && saved == false && this.transform == AIPath.target.transform) { //speed.x *= -1; this.gameObject.transform.Rotate(Vector3.up, 180); Interface.saved += 1; saved = true; AIPath.target = AIPath.spawnpoint.transform; botscript = col.gameObject.GetComponent("AIPath") as AIPath; botscript.TrySearchPath(); //yield return new WaitForSeconds (0.1); //transform.Rotate(transform.eulerAngles.x,transform.eulerAngles.y-150,transform.eulerAngles.z); } } if (col.gameObject.name.StartsWith("border")) { Destroy(this.gameObject); Interface.total += 1; Spawn.amount--; //speed.x *= -1; //transform.Rotate(transform.eulerAngles.x,transform.eulerAngles.y-150,transform.eulerAngles.z); } }
private static int TrySearchPath(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); AIPath aIPath = (AIPath)ToLua.CheckObject(L, 1, typeof(AIPath)); float num = aIPath.TrySearchPath(); LuaDLL.lua_pushnumber(L, (double)num); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public override void Move(Vector3 direction) { _pathfinder.Target = direction; _pathfinder.TrySearchPath(); }