public void ExecuteOnTarget(HeroKitObject targetObject, HeroKitObject sceneObject) { // get nav mesh agent NavMeshAgent navMeshAgent = targetObject.GetHeroComponent <NavMeshAgent>("navMeshAgent", false, false, false); if (navMeshAgent == null) { navMeshAgent = targetObject.GetHeroComponent <NavMeshAgent>("navMeshAgent", true); navMeshAgent = HeroKitCommonRuntime.CreateNavMeshAgent(navMeshAgent); } // get the pathfinding script HeroPathfinding3D moveObject = targetObject.GetHeroComponent <HeroPathfinding3D>("HeroPathfinding3D", true); moveObject.navMeshAgent = navMeshAgent; moveObject.targetObject = sceneObject; moveObject.navigationType = 1; moveObject.Initialize(); }
public void ExecuteOnTarget(HeroKitObject targetObject) { Vector3 pos = CoordinatesValue.GetValue(heroKitObject, 2, 3, 4, 5, 6, 7, targetObject.transform.localPosition); // get nav mesh agent NavMeshAgent navMeshAgent = targetObject.GetHeroComponent <NavMeshAgent>("navMeshAgent"); if (navMeshAgent == null) { navMeshAgent = targetObject.GetHeroComponent <NavMeshAgent>("navMeshAgent", true); navMeshAgent = HeroKitCommonRuntime.CreateNavMeshAgent(navMeshAgent); } // get the pathfinding script HeroPathfinding3D moveObject = targetObject.GetHeroComponent <HeroPathfinding3D>("HeroPathfinding3D", true); moveObject.navMeshAgent = navMeshAgent; moveObject.navigationType = 2; moveObject.destination = pos; moveObject.Initialize(); }