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() { player = GetLinkedObject("target").GetComponent <CharactersManager>(); if (player == null) { Debug.Log("[error] Attack Action Start: Player is null!"); } anim_comp = GetComponent <CompAnimation>(); audio_comp = GetComponent <CompAudio>(); if (player.dying == false) { anim_comp.SetClipDuration("Attack", attack_duration); anim_comp.PlayAnimationNode("Attack"); Debug.Log("Back to Attack", Department.IA); audio_comp.PlayEvent("Enemy1_Slash"); } damage_done = false; shield_attack = false; //Interrupt player action return(true); }
protected virtual void Start() { player = GetLinkedObject("player_obj"); health = GetLinkedObject("health_obj").GetComponent <Hp>(); stamina = GetLinkedObject("stamina_obj").GetComponent <Stamina>(); stamina_img = stamina.GetComponent <CompImage>(); leftamina_img = GetLinkedObject("leftamina_bar").GetComponent <CompImage>(); mana = GetLinkedObject("mana_obj").GetComponent <Mana>(); mana_img = mana.GetComponent <CompImage>(); left_mana_img = GetLinkedObject("leftmana_bar").GetComponent <CompImage>(); audio = player.GetComponent <CompAudio>(); movement = player.GetComponent <MovementController>(); anim_controller = GetComponent <CompAnimation>(); damage_feedback = player.GetComponent <DamageFeedback>(); characters_manager = player.GetComponent <CharactersManager>(); enemy_manager = GetLinkedObject("player_enemies_manager").GetComponent <EnemiesManager>(); play_breathing_audio = false; currently_playing_b_audio = false; force_audio = false; }
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 override bool ActionStart() { comp_animation = GetComponent <CompAnimation>(); comp_audio = GetComponent <CompAudio>(); comp_animation.PlayAnimationNode("Draw"); comp_animation.SetClipDuration("Draw", duration); return(true); }
void Start() { map = GetLinkedObject("map"); player = GetLinkedObject("player"); align = GetComponent <Align_Steering>(); arrive = GetComponent <Arrive_Steering>(); seek = GetComponent <Seek_Steering>(); anim_comp = GetComponent <CompAnimation>(); transform_comp = GetComponent <Transform>(); audio_comp = GetComponent <CompAudio>(); player_t = GetLinkedObject("player_obj"); BT bt = GetComponent <EnemySword_BT>(); if (bt == null) { bt = GetComponent <EnemyShield_BT>(); } if (bt == null) { bt = GetComponent <EnemySpear_BT>(); } if (bt == null) { bt = GetComponent <Boss_BT>(); } float interpolation = bt.GetCurrentInterpolation(); current_max_vel = hurt_max_vel + (max_vel - hurt_max_vel) * interpolation; current_max_accel = hurt_accel + (max_accel - hurt_accel) * interpolation; current_max_rot_vel = hurt_max_rot_vel + (max_rot_vel - hurt_max_rot_vel) * interpolation; current_max_rot_accel = hurt_max_rot_accel + (max_rot_accel - hurt_max_rot_accel) * interpolation; Vector3 fw = transform_comp.GetForwardVector(); path = new List <PathNode>(); //Set Occupied tile in Pathfinder tile = new PathNode(0, 0); tile.SetCoords((int)(transform_comp.position.x / tile_size + Mathf.Epsilon), (int)(transform_comp.position.z / tile_size + Mathf.Epsilon)); map.GetComponent <Pathfinder>().UpdateOccupiedTiles(gameObject.GetName(), tile); //Set direction SetDirection(); //Sideways animation speeds anim_comp.SetClipDuration("WalkRight", sideways_anim_speed); anim_comp.SetClipDuration("WalkLeft", sideways_anim_speed); anim_comp.SetClipDuration("WalkBack", sideways_anim_speed); anim_comp.SetClipDuration("WalkFront", sideways_anim_speed); blocking = false; path.Clear(); }
public override bool ActionStart() { state = SWA_STATE.PRE_APPLY; anim = GetComponent <CompAnimation>(); anim.SetTransition("ToAttack"); anim.SetClipDuration("Attack", attack_duration); player = GetLinkedObject("target").GetComponent <CharactersManager>(); //Interrupt player action return(true); }
public override bool ActionStart() { GetComponent <Align_Steering>().SetEnabled(false); GetComponent <Arrive_Steering>().SetEnabled(false); GetComponent <Seek_Steering>().SetEnabled(false); //GetComponent<CompAnimation>().SetTransition("ToStun"); anim_comp = GetComponent <CompAnimation>(); anim_comp.SetClipDuration("Stun", stun_duration); anim_comp.PlayAnimationNode("Stun"); return(true); }
void OnLeverActivated() { // Called when lever is activated. Set flag to true and play the animation. on_lever_animation = true; anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller != null) { anim_controller.PlayAnimation(lever_animation_name); } // Block Walkability SetPathWalkable(1, 1); }
public override ACTION_RESULT ActionUpdate() { // Debug.Log("[error]Is melee attack:" + melee_attack); if (melee_attack) { if (interupt == true) { return(ACTION_RESULT.AR_FAIL); } //Doing attack anim = GetComponent <CompAnimation>(); if (state == SWA_STATE.PRE_APPLY && anim.IsAnimOverXTime(apply_damage_point)) { state = SWA_STATE.POST_APPLY; player.GetDamage(damage); //Apply damage to the target //Play audio fx } else if (state == SWA_STATE.POST_APPLY && anim.IsAnimationStopped("Attack")) { state = SWA_STATE.WAITING; return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); } else { if (interupt == true) { return(ACTION_RESULT.AR_FAIL); } //Doing attack anim = GetComponent <CompAnimation>(); if (state == SWA_STATE.PRE_APPLY && anim.IsAnimOverXTime(apply_damage_point)) { state = SWA_STATE.POST_APPLY; player.GetDamage(damage); //Apply damage to the target //Play audio fx } else if (state == SWA_STATE.POST_APPLY && anim.IsAnimationStopped("Attack")) { state = SWA_STATE.WAITING; return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); } }
public override bool ActionStart() { anim_comp = GetComponent <CompAnimation>(); audio_comp = GetComponent <CompAudio>(); anim_comp.PlayAnimationNode("Die"); //TODO_AI: Die audio audio_comp.PlayEvent("Enemy_SwordDrop"); //PLAY COMBAT MUSIC Audio.ChangeState("MusicState", "None"); GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = false; Debug.Log("COMBAT OFF", Department.PLAYER, Color.BLUE); StatsScore.KillEnemy(); //Play Dead Audio if (GetComponent <EnemyShield_BT>() != null) { audio_comp.PlayEvent("Enemy3_Dead"); } else if (GetComponent <EnemySpear_BT>() != null) { audio_comp.PlayEvent("Enemy2_Dead"); } else if (GetComponent <EnemySword_BT>() != null) { audio_comp.PlayEvent("Enemy1_Dead"); } //Deactivate Listener if (GetComponent <SpearGuard_Listener>() != null) { GetComponent <SpearGuard_Listener>().SetEnabled(false); } else if (GetComponent <ShieldGuard_Listener>() != null) { GetComponent <ShieldGuard_Listener>().SetEnabled(false); } else if (GetComponent <SwordGuard_Listener>() != null) { GetComponent <SwordGuard_Listener>().SetEnabled(false); } anim_comp.SetClipDuration("Die", duration); GetComponent <CompCollider>().CollisionActive(false); return(true); }
// ------------------------------------------------------------------------------------- void OnLeverActivated() { // Called when lever is activated. Set flag to true and play the animation. on_lever_animation = true; Debug.Log("Animation called"); anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller != null) { anim_controller.PlayAnimation(lever_animation_name); Debug.Log("Animation activated"); } else { Debug.Log("Animation IS NULL!!"); } }
public override bool ActionStart() { anim_comp = GetComponent <CompAnimation>(); anim_comp.SetTransition("ToSheatheSword"); //TODO_AI: Audio disengage? //GetComponent<CompAudio>().PlayEvent("Dracarys"); anim_comp.SetClipDuration("Sheathe Sword", duration); //PLAY COMBAT MUSIC Audio.ChangeState("MusicState", "None"); GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = false; Debug.Log("COMBAT OFF", Department.PLAYER, Color.BLUE); return(true); }
public override bool ActionStart() { state = SWA_STATE.PRE_APPLY; anim_comp = GetComponent <CompAnimation>(); player = GetLinkedObject("target").GetComponent <CharactersManager>(); if (player.dying == false) { anim_comp.SetClipDuration("Attack", attack_duration); anim_comp.PlayAnimationNode("Attack"); GetComponent <CompAudio>().PlayEvent("Enemy2_Slash"); } //Interrupt player action return(true); }
void Start() { lever_go = GetLinkedObject("lever_go"); if (door_to_open1 != null) { door_to_open1 = GetLinkedObject("door_to_open1"); } if (door_to_open2 != null) { door_to_open2 = GetLinkedObject("door_to_open2"); } close_door_collider = GetLinkedObject("close_door_collider"); audio = GetComponent <CompAudio>(); if (audio == null) { Debug.Log("There is no audio in puzzle!"); } anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller == null) { Debug.Log("Animation is null!"); } lever_interact = GetLinkedObject("lever_interact"); if (lever_interact != null) { lever_interact.SetActive(false); Debug.Log("[green] Deactivated Interact"); } lvl_player = GetLinkedObject("lvl_player"); if (lvl_player != null) { movement_player = lvl_player.GetComponent <MovementController>(); } // ------------------------------------------------------- }
void Update() { //-- TMP: Debug ----- if (on_lever_animation && anim_controller.IsAnimationStopped(lever_animation_name)) { OnLeverAnimFinish(); } //-- Lever Triggered ----- if (on_lever_range && !active_lever && !on_lever_animation) { if (Input.GetInput_KeyDown("Interact", "Player")) { if (movement_player == null) { OnLeverActivated(); GetComponent <CompAudio>().PlayEvent("Lever"); lever_interact.SetActive(false); } //Auxiliary case to detect in the final boss lever if player is moving (to avoid reproducing the cutscene at the wrong tile) else if (movement_player != null && movement_player.IsMoving() == false) { OnLeverActivated(); GetComponent <CompAudio>().PlayEvent("Lever"); lever_interact.SetActive(false); } } } if (on_lever_animation) { anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller != null) { if (anim_controller.IsAnimationStopped(lever_animation_name)) { Debug.Log("Lever animation ended."); // The lever animation has stopped so puzzle must start. OnLeverAnimFinish(); } } } }
public override bool ActionStart() { event_to_react.start_counting = false; bt = GetComponent <EnemySword_BT>(); if (bt == null) { bt = GetComponent <EnemyShield_BT>(); } if (bt == null) { bt = GetComponent <EnemySpear_BT>(); } percep_sight = GetComponent <PerceptionSightEnemy>(); comp_anim = GetComponent <CompAnimation>(); move.GoToPlayer((uint)bt.range); interupt = false; bool ret = move.ActionStart(); return(ret); }
void Update() { //-- TMP: Debug ----- /* if(on_lever_animation && anim_controller.IsAnimationStopped(lever_animation_name)) * { * OnLeverAnimFinish(); * }*/ //-- Lever Triggered ----- if (on_lever_range && !active_lever && !on_lever_animation) { //TODO: Change to GetKey_Action if (Input.GetInput_KeyDown("Interact", "Player")) { //Reset other puzzles if exists to avoid audio conflicts if (other_lever_1 != null) { other_lever_1.GetComponent <Lever>().ResetPuzzle(); other_lever_1.GetComponent <PuzzleCountdown>().StopCountdown(); } if (other_lever_2 != null) { other_lever_2.GetComponent <Lever>().ResetPuzzle(); other_lever_2.GetComponent <PuzzleCountdown>().StopCountdown(); } SetOrientationVectors(); OnLeverActivated(); GetComponent <CompAudio>().PlayEvent("Lever"); lever_interact.SetActive(false); } } //--------------------- if (on_lever_animation) { anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller != null) { if (anim_controller.IsAnimationStopped(lever_animation_name)) { // The lever animation has stopped so puzzle must start. OnLeverAnimFinish(); } } } if (active_lever) { if (!phase1) // Set info all barrels { SetInfo(line1, 0); SetInfo(line2, 1); SetInfo(line3, 2); SetInfo(line4, 3); SetInfo(line5, 4); SetInfo(line6, 5); phase1 = true; } if (!phase2) // Move barrels mode.PUZZLE { MoveBarrels(line1); MoveBarrels(line2); MoveBarrels(line3); MoveBarrels(line4); MoveBarrels(line5); MoveBarrels(line6); phase3 = true; phase2 = true; phase_wait = true; time = Time.realtimeSinceStartup + delay_second_mode; audio.PlayEvent("Chain"); MoveChains(true); } if (phase_wait) // wait to move the other mode { // Wait delay to move other barrels float time_transcured = Time.realtimeSinceStartup; if (time_transcured >= time) { phase3 = false; phase_wait = false; } } if (!phase3) // Move barrels mode.FILLING { MoveBarrels(line1, true); MoveBarrels(line2, true); MoveBarrels(line3, true); MoveBarrels(line4, true); MoveBarrels(line5, true); MoveBarrels(line6, true); phase3 = true; editmap = true; } if (fill_barrel != null && fill_barrel.IsPlaced() == true) { if (editmap) { audio.StopEvent("Chain"); SetPathWalkable(0, 3); editmap = false; countdown.StartCountdown(); MoveChains(false); } else if (countdown.IsCountdownOver()) { ResetPuzzle(); } } } }
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); }
//-------------- void Start() { tile_size = 25.4f; lever_go = GetLinkedObject("lever_go"); audio = GetComponent <CompAudio>(); if (audio == null) { Debug.Log("[error] There is no audio in puzzle!"); } countdown = GetComponent <PuzzleCountdown>(); if (countdown == null) { Debug.Log("[error] There is no countdown in puzzle!"); } anim_controller = lever_go.GetComponent <CompAnimation>(); if (anim_controller == null) { Debug.Log("[error] Animation is null!"); } barrel_puzzel_manager = GetComponent <BarrelPuzzleManager>(); if (barrel_puzzel_manager == null) { Debug.Log("[error] Animation is null!"); } Puzzle_line_1 = GetLinkedObject("Puzzle_line_1"); Puzzle_line_2 = GetLinkedObject("Puzzle_line_2"); Puzzle_line_3 = GetLinkedObject("Puzzle_line_3"); Puzzle_line_4 = GetLinkedObject("Puzzle_line_4"); Puzzle_line_5 = GetLinkedObject("Puzzle_line_5"); Puzzle_line_6 = GetLinkedObject("Puzzle_line_6"); line1 = new List <GameObject>(); line2 = new List <GameObject>(); line3 = new List <GameObject>(); line4 = new List <GameObject>(); line5 = new List <GameObject>(); line6 = new List <GameObject>(); // Get All barrels from Puzzle. SetBarrels(); // Desactivate all barrels, while the player dont stay in puzzle. DesactivateBarrels(line1); DesactivateBarrels(line2); DesactivateBarrels(line3); DesactivateBarrels(line4); DesactivateBarrels(line5); DesactivateBarrels(line6); // Map current_path = new Path(barrel_per_line, number_lines, puzzle_orientation); GeneratePath(); lever_interact = GetLinkedObject("lever_interact"); lever_interact.SetActive(false); if (other_lever_1 != null) { other_lever_1 = GetLinkedObject("other_lever_1"); } if (other_lever_2 != null) { other_lever_2 = GetLinkedObject("other_lever_2"); } chain_line_1 = GetLinkedObject("chain_line_1"); chain_line_2 = GetLinkedObject("chain_line_2"); chain_line_3 = GetLinkedObject("chain_line_3"); chain_line_4 = GetLinkedObject("chain_line_4"); chain_line_5 = GetLinkedObject("chain_line_5"); chain_line_6 = GetLinkedObject("chain_line_6"); chains_1 = new List <GameObject>(); chains_2 = new List <GameObject>(); chains_3 = new List <GameObject>(); chains_4 = new List <GameObject>(); chains_5 = new List <GameObject>(); chains_6 = new List <GameObject>(); // Get All Chains from Puzzle. SetChains(); //// Testing -------------------------------------------- //for (int y = 0; y < number_lines; y++) //{ // for (int x = 0; x < barrel_per_line; x++) // { // current_path.walkability[x, y] = 0; // } //} //current_path.walkability[4, 0] = 1; //current_path.walkability[4, 1] = 1; //current_path.walkability[4, 2] = 1; //current_path.walkability[4, 3] = 1; //current_path.walkability[5, 3] = 1; //current_path.walkability[5, 4] = 1; //current_path.walkability[5, 5] = 1; // ------------------------------------------------------- }
public void Start() { animator = GetComponent <CompAnimation>(); player = GetLinkedObject("player"); }
void Start() { anim = GetComponent <CompAnimation>(); }