public override ACTION_RESULT ActionUpdate() { if (player.dying) { Debug.Log("DON'T ATTACK PLAYER", Department.PLAYER, Color.YELLOW); return(ACTION_RESULT.AR_FAIL); //Player is dead, don't attack } if (melee_attack) { if (interupt == true) { return(ACTION_RESULT.AR_FAIL); } //Doing attack if (state == SWA_STATE.PRE_APPLY && anim_comp.IsAnimOverXTime(apply_damage_point)) { state = SWA_STATE.POST_APPLY; if (player.GetDamage(damage) == true) { GetComponent <CompAudio>().PlayEvent("SwordHit"); } } else if (state == SWA_STATE.POST_APPLY && anim_comp.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 if (state == SWA_STATE.PRE_APPLY && anim_comp.IsAnimOverXTime(apply_damage_point)) { state = SWA_STATE.POST_APPLY; if (player.GetDamage(damage) == true) { GetComponent <CompAudio>().PlayEvent("SwordHit"); } } else if (state == SWA_STATE.POST_APPLY && anim_comp.IsAnimationStopped("Attack")) { state = SWA_STATE.WAITING; return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); } }
public override ACTION_RESULT ActionUpdate() { if (interupt == true) { return(ACTION_RESULT.AR_FAIL); } /*if(anim_comp.IsAnimOverXTime(0.3f) && !played_audio) * { * if(GetComponent<EnemyShield_BT>() != null) * audio_comp.PlayEvent("Enemy3_Hurt"); * * if (GetComponent<EnemySpear_BT>() != null) * audio_comp.PlayEvent("Enemy2_Hurt"); * * if (GetComponent<EnemySword_BT>() != null) * audio_comp.PlayEvent("Enemy1_Hurt"); * * played_audio = true; * }*/ if (anim_comp.IsAnimationStopped(animation_clip)) { return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); }
public override ACTION_RESULT ActionUpdate() { if (anim_comp.IsAnimationStopped("Sheathe Sword")) { return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); }
public override ACTION_RESULT ActionUpdate() { if (player.dying) { Debug.Log("DON'T ATTACK PLAYER", Department.PLAYER, Color.ORANGE); return(ACTION_RESULT.AR_FAIL); //Player is dead, don't attack } if (state == BWA_STATE.PRE_APPLY && GetComponent <CompAnimation>().IsAnimOverXTime(apply_damage_point)) { anim.SetClipDuration("WideAttack", (attack_duration / (1.0f - apply_damage_point))); state = BWA_STATE.POST_APPLY; int enemy_tile_x = move.GetCurrentTileX(); int enemy_tile_y = move.GetCurrentTileY(); movement_ctrl.GetPlayerPos(out int player_tile_x, out int player_tile_y); audio.PlayEvent("BossSwordSwing"); switch (move.GetDirection()) { case Movement_Action.Direction.DIR_WEST: if ((enemy_tile_x - 1 == player_tile_x || enemy_tile_x == player_tile_x) && (player_tile_y == enemy_tile_y || player_tile_y == enemy_tile_y - 1 || player_tile_y == enemy_tile_y + 1)) { characters_manager.GetDamage(damage); } break; case Movement_Action.Direction.DIR_EAST: if ((enemy_tile_x + 1 == player_tile_x || enemy_tile_x == player_tile_x) && (player_tile_y == enemy_tile_y || player_tile_y == enemy_tile_y - 1 || player_tile_y == enemy_tile_y + 1)) { characters_manager.GetDamage(damage); } break; case Movement_Action.Direction.DIR_NORTH: if ((enemy_tile_y - 1 == player_tile_y || enemy_tile_y == player_tile_y) && (player_tile_x == enemy_tile_x || player_tile_x == enemy_tile_x - 1 || player_tile_x == enemy_tile_x + 1)) { characters_manager.GetDamage(damage); } break; case Movement_Action.Direction.DIR_SOUTH: if ((enemy_tile_y + 1 == player_tile_y || enemy_tile_y == player_tile_y) && (player_tile_x == enemy_tile_x || player_tile_x == enemy_tile_x - 1 || player_tile_x == enemy_tile_x + 1)) { characters_manager.GetDamage(damage); } break; } } else if (state == BWA_STATE.POST_APPLY && anim.IsAnimationStopped("WideAttack")) { state = BWA_STATE.WAITING; return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); }
public override ACTION_RESULT ActionUpdate() { if (anim_comp.IsAnimationStopped("Die") && blood_particle == false) { GameObject floor_blood = SpawnPrefabFromPos("Floor_Blood", transform.GetGlobalPosition(), transform.GetRotation(), new Vector3(0, 0.1f, 5)); blood_particle = true; Debug.Log("I'M DEAD", Department.PLAYER, Color.PINK); } return(ACTION_RESULT.AR_IN_PROGRESS); }
public override ACTION_RESULT ActionUpdate() { if (comp_animation.IsAnimOverXTime(0.2f) && play_audio == false && GetComponent <EnemySpear_BT>() == null) { comp_audio.PlayEvent("Enemy_SwordDraw"); play_audio = true; } if (comp_animation.IsAnimationStopped("Draw")) { return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); }
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); } }
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 ACTION_RESULT ActionUpdate() { if (interupt == true) { return(ACTION_RESULT.AR_FAIL); } Vector3 my_pos = transform.position; Vector3 movement = new Vector3(Vector3.Zero); if (anim_comp.IsAnimationStopped(animation_clip_push)) { anim_comp.SetTransition("ToIdleAttack"); Debug.Log("Tile Destiny x: " + target_x + "y:" + target_y, Department.IA, Color.YELLOW); move.SetEnemyTile(target_x, target_y); movement.x = (target_x * move.tile_size) - my_pos.x; movement.z = (target_y * move.tile_size) - my_pos.z; movement = (movement.Normalized * move.tile_size * (1 - arrive_comp.min_distance)) * push_velocity; transform.SetPosition(my_pos + ((movement * Time.deltaTime) / push_time)); if (push_timer >= 0.01f) { push_timer = 0.0f; return(ACTION_RESULT.AR_SUCCESS); } else { push_timer = push_timer + Time.deltaTime; return(ACTION_RESULT.AR_IN_PROGRESS); } } movement.x = (target_x * move.tile_size) - my_pos.x; movement.z = (target_y * move.tile_size) - my_pos.z; movement = (movement.Normalized * move.tile_size * (1 - arrive_comp.min_distance)) * push_velocity; transform.SetPosition(my_pos + ((movement * Time.deltaTime) / push_time)); return(ACTION_RESULT.AR_IN_PROGRESS); }
public override ACTION_RESULT ActionUpdate() { if (player.dying) { Debug.Log("DON'T ATTACK PLAYER", Department.PLAYER, Color.YELLOW); return(ACTION_RESULT.AR_FAIL); //Player is dead, don't attack } if (GetComponent <CompAnimation>().IsAnimOverXTime(damage_point) && damage_done == false) { damage_done = true; if (shield_attack) { player.ApplyFatigue(fatigue); } else { if (player.GetDamage(damage) == true) { audio_comp.PlayEvent("SwordHit"); anim_comp.SetFirstActiveBlendingClipWeight(0.0f); } else { anim_comp.SetFirstActiveBlendingClipWeight(1.0f); } } } if (anim_comp.IsAnimationStopped("Attack")) { return(ACTION_RESULT.AR_SUCCESS); } return(ACTION_RESULT.AR_IN_PROGRESS); }
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(); } } } }