public override bool ActionStart() { move = GetComponent <Movement_Action>(); move.LookAtPlayer(); move.ActionStart(); return(true); }
// Use this for initialization void Start() { in_range = false; SetEnabled(false); move = GetComponent <Movement_Action>(); transform = GetComponent <Transform>(); }
public override bool ActionStart() { anim = GetComponent <CompAnimation>(); audio = GetComponent <CompAudio>(); move = GetComponent <Movement_Action>(); movement_ctrl = GetLinkedObject("player_obj").GetComponent <MovementController>(); characters_manager = GetLinkedObject("player_obj").GetComponent <CharactersManager>(); state = BWA_STATE.PRE_APPLY; target = GetLinkedObject("target"); player = target.GetComponent <CharactersManager>(); if (player == null) { Debug.Log("[error] Attack Action Start: Player is null!"); } if (player.dying == false) { state = BWA_STATE.PRE_APPLY; Debug.Log("Wide attack anim play", Department.IA); GetComponent <CompAnimation>().PlayAnimationNode("WideAttack"); GetComponent <CompAnimation>().SetClipDuration("WideAttack", preparation_time / apply_damage_point); GetComponent <CompAudio>().PlayEvent("AttackPreparation"); } return(true); }
public override bool ActionStart() { Debug.Log("PUSH ANIMATION", Department.PHYSICS, Color.ORANGE); arrive_comp = GetComponent <Arrive_Steering>(); GetComponent <Align_Steering>().SetEnabled(false); Movement_Action.Direction dir = GetComponent <Movement_Action>().GetDirection(); move = GetComponent <Movement_Action>(); anim_comp = GetComponent <CompAnimation>(); GetComponent <PerceptionSightEnemy>().GetPlayerTilePos(out int player_x, out int player_y); int tile_x = move.GetCurrentTileX(); int tile_y = move.GetCurrentTileY(); int dif_x = player_x - tile_x; int dif_y = player_y - tile_y; animation_clip_push = "Push"; anim_comp.PlayAnimationNode("Push"); target_x = move.GetCurrentTileX(); target_y = move.GetCurrentTileY(); target_x += (int)push_direction.x; target_y += (int)push_direction.z; return(true); }
public void Start() { align = gameObject.GetComponent <Align_Steering>(); movement = gameObject.GetComponent <Movement_Action>(); if (gameObject.GetComponent <EnemySword_BT>() != null) { bt = gameObject.GetComponent <EnemySword_BT>(); } else if (gameObject.GetComponent <EnemySpear_BT>() != null) { Debug.Log("SPEAR ENEMY!", Department.IA, Color.PINK); bt = gameObject.GetComponent <EnemySpear_BT>(); } else if (gameObject.GetComponent <EnemyShield_BT>() != null) { bt = gameObject.GetComponent <EnemyShield_BT>(); } if (bt != null) { bt.current_hp = total_hp; bt.total_hp = total_hp; bt.attack_damage = attack_damage; bt.attack_cooldown = attack_cooldown; } }
public override void Start() { this.range = 2; current_map = GetLinkedObject("current_map"); if (current_map == null) { Debug.Log("Map GameObject in Enemy spear is NULL"); } rand = new System.Random(); mov = GetComponent <Movement_Action>(); if (mov == null) { Debug.Log("Script movement action in Enemy spear is NULL"); } GameObject Temp_go = GetLinkedObject("enemies_manager"); if (Temp_go == null) { Debug.Log("Gameobject enemies_manager not found"); } else { EnemiesManager enemy_manager = Temp_go.GetComponent <EnemiesManager>(); if (enemy_manager == null) { Debug.Log("EnemySpear_BT: enemies_manager is not detected"); } else { enemy_manager.AddLanceEnemy(gameObject); } } if (texture_type == 0) { enemy_mat_sword = GetMaterialByName("Alpha1_SpearEnemy_Material_21_04"); } else if (texture_type == 1) { enemy_mat_sword = GetMaterialByName("Alpha1_SpearEnemy2_Material_21_04"); } spear_name = GetLinkedObject("spear_name"); base.Start(); base.DeactivateHUD(spear_name); }
public override bool ActionStart() { int current_tile_x = GetComponent <Movement_Action>().GetCurrentTileX(); int current_tile_y = GetComponent <Movement_Action>().GetCurrentTileY(); move = GetComponent <Movement_Action>(); move.GoTo(event_to_react.objective_tile_x, event_to_react.objective_tile_y); bool ret = move.ActionStart(); init_tile_x = current_tile_x; init_tile_y = current_tile_y; my_state = INVESTIGATESTATE.GOING_TO_INVESTIGATE; //TODO_AI:hear something audio //GetComponent<CompAudio>().PlayEvent("Dracarys"); return(ret); }
void Start() { delta = 0.0f; move = GetComponent <Movement_Action>(); SetEnabled(false); }
void Start() { move = GetComponent <Movement_Action>(); }
public override bool ActionStart() { interupt = false; /*CompAudio audio = GetComponent<CompAudio>(); * audio.PlayEvent("Enemy2_Hurt"); * audio.PlayEvent("SwordHit");*/ move = GetComponent <Movement_Action>(); anim_comp = GetComponent <CompAnimation>(); audio_comp = GetComponent <CompAudio>(); if (next_dmg_type == Enemy_BT.ENEMY_GET_DAMAGE_TYPE.DEFAULT) { int tile_x = move.GetCurrentTileX(); int tile_y = move.GetCurrentTileY(); int player_x = tile_x; int player_y = tile_y; MovementController temp = GetLinkedObject("player_obj").GetComponent <MovementController>(); if (temp != null) { temp.GetPlayerPos(out int x, out int y); player_x = x; player_y = y; } int dif_x = player_x - tile_x; int dif_y = player_y - tile_y; Movement_Action.Direction dir = move.GetDirection(); switch (dir) { case Movement_Action.Direction.DIR_EAST: if (dif_x < 0) { animation_clip = "HitBack"; anim_comp.PlayAnimationNode("HitBack"); } else if (dif_x > 0) { animation_clip = "HitFront"; anim_comp.PlayAnimationNode("HitFront"); } else if (dif_y < 0) { animation_clip = "HitLeft"; anim_comp.PlayAnimationNode("HitLeft"); } else if (dif_y > 0) { animation_clip = "HitRight"; anim_comp.PlayAnimationNode("HitRight"); } break; case Movement_Action.Direction.DIR_NORTH: if (dif_x < 0) { animation_clip = "HitLeft"; anim_comp.PlayAnimationNode("HitLeft"); } else if (dif_x > 0) { animation_clip = "HitRight"; anim_comp.PlayAnimationNode("HitRight"); } else if (dif_y < 0) { animation_clip = "HitFront"; anim_comp.PlayAnimationNode("HitFront"); } else if (dif_y > 0) { animation_clip = "HitBack"; anim_comp.PlayAnimationNode("HitBack"); } break; case Movement_Action.Direction.DIR_SOUTH: if (dif_x < 0) { animation_clip = "HitRight"; anim_comp.PlayAnimationNode("HitRight"); } else if (dif_x > 0) { animation_clip = "HitLeft"; anim_comp.PlayAnimationNode("HitLeft"); } else if (dif_y < 0) { animation_clip = "HitBack"; anim_comp.PlayAnimationNode("HitBack"); } else if (dif_y > 0) { animation_clip = "HitFront"; anim_comp.PlayAnimationNode("HitFront"); } break; case Movement_Action.Direction.DIR_WEST: if (dif_x < 0) { animation_clip = "HitFront"; anim_comp.PlayAnimationNode("HitFront"); } else if (dif_x > 0) { animation_clip = "HitBack"; anim_comp.PlayAnimationNode("HitBack"); } else if (dif_y < 0) { animation_clip = "HitRight"; anim_comp.PlayAnimationNode("HitRight"); } else if (dif_y > 0) { animation_clip = "HitLeft"; anim_comp.PlayAnimationNode("HitLeft"); } break; } } else if (next_dmg_type == Enemy_BT.ENEMY_GET_DAMAGE_TYPE.FIREWALL) { animation_clip = "HitFire"; anim_comp.PlayAnimationNode("HitFire"); } anim_comp.SetClipDuration(animation_clip, duration); //TODO_AI: Hurt audio //GetComponent<CompAudio>().PlayEvent("JaimeHurt"); return(true); }
public BT FindEnemyByTile(int x, int y) { int size = sword_enemies.Count; for (int k = 0; k < size; k++) { GameObject enemy_t = sword_enemies[k]; if (enemy_t != null) { Movement_Action temp_move = enemy_t.GetComponent <Movement_Action>(); if (temp_move != null) { int tile_x = temp_move.GetCurrentTileX(); int tile_y = temp_move.GetCurrentTileY(); if (x == tile_x && y == tile_y) { if (enemy_t.GetComponent <EnemySword_BT>() != null && enemy_t.GetComponent <EnemySword_BT>().GetCurrentHP() > 0) { return(enemy_t.GetComponent <EnemySword_BT>()); } else { return(null); } } } else { Debug.Log("[error] No movement action!"); } } else { Debug.Log("[error] Sword enemy null!"); } } size = lance_enemies.Count; for (int k = 0; k < size; k++) { GameObject enemy_t = lance_enemies[k]; if (enemy_t != null) { Movement_Action temp_move = enemy_t.GetComponent <Movement_Action>(); if (temp_move != null) { int tile_x = temp_move.GetCurrentTileX(); int tile_y = temp_move.GetCurrentTileY(); if (x == tile_x && y == tile_y) { if (enemy_t.GetComponent <EnemySpear_BT>() != null && enemy_t.GetComponent <EnemySpear_BT>().GetCurrentHP() > 0) { return(enemy_t.GetComponent <EnemySpear_BT>()); } else { return(null); } } } else { Debug.Log("[error] No movement action!"); } } else { Debug.Log("[error] Sowrd enemy null!"); } } size = shield_enemies.Count; for (int k = 0; k < size; k++) { GameObject enemy_t = shield_enemies[k]; if (enemy_t != null) { Movement_Action temp_move = enemy_t.GetComponent <Movement_Action>(); if (temp_move != null) { int tile_x = temp_move.GetCurrentTileX(); int tile_y = temp_move.GetCurrentTileY(); if (x == tile_x && y == tile_y) { if (enemy_t.GetComponent <EnemyShield_BT>() != null && enemy_t.GetComponent <EnemyShield_BT>().GetCurrentHP() > 0) { return(enemy_t.GetComponent <EnemyShield_BT>()); } else { return(null); } } } else { Debug.Log("[error] No movement action!"); } } else { Debug.Log("[error] Sword enemy null!"); } } if (boss != null) { Movement_Action t_move = boss.GetComponent <Movement_Action>(); if (t_move != null) { int tile_x = t_move.GetCurrentTileX(); int tile_y = t_move.GetCurrentTileY(); if (x == tile_x && y == tile_y) { return(boss.GetComponent <Boss_BT>()); } } else { Debug.Log("[error] No movement action!"); } } return(null); }
void Start() { blocking = false; move = GetComponent <Movement_Action>(); player = GetLinkedObject("player"); }