using UnityEngine; //Player PlayerKnockback ¶¯×÷-»÷ÍË public class PlayerKnockback : MonoBehaviour { private RigidbodyHolder allRigs;//14 private StandingDataHandler standing; private WeaponHandler weapons; private void Start() { allRigs = GetComponent(); standing = GetComponent(); weapons = GetComponent(); } private void Update() { if (Input.GetKeyDown(KeyCode.K)) //kill { AddSeriousKnockback(); } } public void AddForce(Vector3 force, Rigidbody rig) { if (force.magnitude > 200f) { AddSeriousKnockback(); force *= 0.1f; } for (int i = 0; i < allRigs.GetAllRigs().Length; i++) { float num = 1f; if (rig == allRigs.GetAllRigs()[i]) { num *= 1f; } allRigs.GetAllRigs()[i].AddForce(force * num * 20f, ForceMode.Acceleration); } } private void AddSeriousKnockback() { GetComponent().Kill(); } private void AddNormalKnockback() { } }