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); }
private void UpdateTranslation() { if (current_acceleration.Length > current_max_accel) { current_acceleration = current_acceleration.Normalized * current_max_accel; } current_velocity.x = current_velocity.x + current_acceleration.x; current_velocity.z = current_velocity.z + current_acceleration.z; if (current_velocity.Length > current_max_vel) { current_velocity = current_velocity.Normalized * current_max_vel; } float point_in_speed = current_velocity.Length / current_max_vel; if (moving_sideways == true) { anim_comp.SetFirstActiveBlendingClipWeight(1.0f - point_in_speed); } else { anim_comp.SetFirstActiveBlendingClipWeight((1.0f - point_in_speed) * (1.0f - point_in_speed)); } //Translate Vector3 pos = new Vector3(transform_comp.position); pos.x = pos.x + current_velocity.x * Time.deltaTime; pos.z = pos.z + current_velocity.z * Time.deltaTime; transform_comp.position = pos; //Clean current_acceleration = new Vector3(Vector3.Zero); }