static int _m_FinalizeMovement(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); { UnityEngine.Vector3 _nextPosition; translator.Get(L, 2, out _nextPosition); UnityEngine.Quaternion _nextRotation; translator.Get(L, 3, out _nextRotation); gen_to_be_invoked.FinalizeMovement( _nextPosition, _nextRotation); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public MoveToPoint2D(Pathfinding.IAstarAI ai, string key, float freq = 0.2f, float variance = 0.025f) : base("MoveToPoint2D") { this.ai = ai; blackboardKey = key; updateFrequency = freq; updateVariance = variance; }
static int _m_MovementUpdate(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); { float _deltaTime = (float)LuaAPI.lua_tonumber(L, 2); UnityEngine.Vector3 _nextPosition; UnityEngine.Quaternion _nextRotation; gen_to_be_invoked.MovementUpdate(_deltaTime, out _nextPosition, out _nextRotation); translator.PushUnityEngineVector3(L, _nextPosition); translator.PushUnityEngineQuaternion(L, _nextRotation); return(2); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void Start() { dest = GetComponent <Pathfinding.AIDestinationSetter>(); ai = GetComponent <Pathfinding.IAstarAI>(); int rando = Random.Range(0, plants.Length - 1); while (plants[rando].IsOccupied()) { rando = Random.Range(0, plants.Length - 1); } growth = plants[rando]; growth.MakeOccupied(); original = growth.point.transform; for (int i = 0; i < plants.Length; i++) { if (plants[i].IsReady()) { original = plants[i].point.transform; growth = plants[i]; growth.MakeOccupied(); } } dest.target = original; dest.enabled = true; }
private void Awake() { ai = GetComponent <Pathfinding.IAstarAI>(); player = GameObject.Find("Player").GetComponent <PlayerControl>(); searchableArea = player.searchableArea; }
IEnumerator LateStart() { yield return(new WaitForSeconds(0.5f)); Pathfinding.AIDestinationSetter ai_destination = this.GetComponent <Pathfinding.AIDestinationSetter>(); target = ai_destination.target; ai_star = this.GetComponent <Pathfinding.IAstarAI>(); base_speed = ai_star.maxSpeed; }
private void Awake() { //For filler animation up = transform.rotation; front = new GameObject("front"); front.transform.position = Vector3.up + transform.position; front.transform.parent = gameObject.transform; pathFinder = GetComponent <Pathfinding.IAstarAI>(); }
static int _s_set_onSearchPath(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); gen_to_be_invoked.onSearchPath = translator.GetDelegate <System.Action>(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _g_get_remainingDistance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.remainingDistance); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _s_set_isStopped(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); gen_to_be_invoked.isStopped = LuaAPI.lua_toboolean(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _g_get_onSearchPath(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.onSearchPath); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _g_get_desiredVelocity(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); translator.PushUnityEngineVector3(L, gen_to_be_invoked.desiredVelocity); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static int _s_set_destination(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); UnityEngine.Vector3 gen_value; translator.Get(L, 2, out gen_value); gen_to_be_invoked.destination = gen_value; } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
void Start() { _spawnManager = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <SpawnManager>(); health = new HealthSystem(max_health); health.Ded += HealthSystem_Ded; speed = this.GetComponent <Pathfinding.IAstarAI>(); oldSpeed = speed.maxSpeed; Renderer [] enemy_colors = this.GetComponentsInChildren <Renderer>(); enemy_color = null; foreach (Renderer enemy in enemy_colors) { if (enemy.tag == "SpriteRenderer") { enemy_color = enemy; } } old_color = enemy_color.material.color; audioSource = GetComponent <AudioSource>(); }
static int _m_Teleport(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 3 && translator.Assignable <UnityEngine.Vector3>(L, 2) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)) { UnityEngine.Vector3 _newPosition; translator.Get(L, 2, out _newPosition); bool _clearPath = LuaAPI.lua_toboolean(L, 3); gen_to_be_invoked.Teleport( _newPosition, _clearPath); return(0); } if (gen_param_count == 2 && translator.Assignable <UnityEngine.Vector3>(L, 2)) { UnityEngine.Vector3 _newPosition; translator.Get(L, 2, out _newPosition); gen_to_be_invoked.Teleport( _newPosition); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to Pathfinding.IAstarAI.Teleport!")); }
protected virtual void Awake() { rb = GetComponent <Rigidbody2D>(); anim = GetComponentInChildren <Animator>(); m_light = GetComponentInChildren <Light>(); health = GetComponent <Health>(); health.SetHealth(m_enemy_starting_health); HUI.maxHealth = m_enemy_starting_health; melee_dmg = m_melee_damage; melee_force = m_melee_force; pixel_offset = pixel_offset_from_bottom; hit_source = rb.AddAS(); hurt_source = rb.AddAS(); death_source = rb.AddAS(); hurt_source.volume = m_hurt_volume; death_source.clip = m_death_sounds[Random.Range(0, m_death_sounds.Length)]; hit_source.pitch = m_sound_pitch * 2; hurt_source.pitch = m_sound_pitch; death_source.pitch = m_sound_pitch; enemy_hurt_time = new WaitForSeconds(m_enemy_hurt_time_float); enemy_hit_time = new WaitForSeconds(m_enemy_hit_time_float); m_path = GetComponent <Pathfinding.IAstarAI>(); m_path.maxSpeed = m_movement_speed; m_dest = GetComponent <Pathfinding.AIDestinationSetter>(); can_attack = true; }
static int _m_Move(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); { UnityEngine.Vector3 _deltaPosition; translator.Get(L, 2, out _deltaPosition); gen_to_be_invoked.Move(_deltaPosition); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_SetPath(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.IAstarAI gen_to_be_invoked = (Pathfinding.IAstarAI)translator.FastGetCSObj(L, 1); { PF.Path _path = (PF.Path)translator.GetObject(L, 2, typeof(PF.Path)); gen_to_be_invoked.SetPath(_path); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void Awake() { ai = GetComponent <Pathfinding.IAstarAI>(); enemy = GetComponent <EnemyPatrol>(); }
public HandleComeToMe(BEnemy _owner, ComeToMeEvent _eventObj) : base(_owner) { eventObj = _eventObj; ai = owner.GetComponent <Pathfinding.IAstarAI>(); }
private void Awake() { ai = GetComponent <Pathfinding.IAstarAI>(); enemy = GetComponent <Eater>(); }
private void Awake() { timer = new Timer(); ai = GetComponent <Pathfinding.IAstarAI>(); }