private void OnTriggerEnter(Collider other) { if (GameManager.isClient) { return; } //Si tiras una gema a un minecart la guardas y se suma el score al jugador if ((isBeingThrown || isCharged) && other.tag == "Minecart") { playerOwner.AddScore(this.value); StopThrowing(); gemPool.ReturnObjectToPool(this.gameObject); } //Si le da a otro jugador por la espalda se mete en su bolsa si puede, si no lo aturde else if (isBeingThrown && !isCharged && other.tag == "PlayerBack") { //Debug.Log("Espalda"); PlayerBack playerBack = other.gameObject.GetComponent <PlayerBack>(); if (playerBack.TryAddGemToPouch(this)) { PlaySound(gemPickup); StopThrowing(); gameObject.SetActive(false); } else { PlaySound(gemHitPlayer); playerBack.Knockback(playerForward, knockbackForce); } } }
void Start() { // 현재 가지고 있는 무기 초기화 playerWeapons = new GameObject[2]; playerWeapons[0] = null; playerWeapons[1] = null; // 크로스헤어 객체 획득 crossHair = CrosshairController.GetInstance(); // 주변에 존재하는 무기를 담을 리스트 aroundWeapons = new List <GameObject>(); // 메인 카메라 획득 playerCamera = CameraControl.GetInstance(); // 애니메이터 컴포넌트 획득 playerAnimator = GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); // 리코의 등과 오른손에 아이템을 장착할 위치 획득 playerBack = GameObject.FindObjectOfType <PlayerBack>(); playerBack2 = GameObject.FindObjectOfType <PlayerBack2>(); playerRightHand = GameObject.FindObjectOfType <PlayerRightHand>(); }