//------------------------------------------------------------------ private void SetStartingWeapon(int playerNumber) { Weapon3D rewardWeapon = Instantiate(weaponRewardFromLastLevel[playerNumber]); rewardWeapon.isReward = true; rewardWeapon.bullets = rewardWeapon.bulletsIfReward; rewardWeapon.hand = playerInfo[playerNumber].PlayerController.playerRightArm.transform.GetChild(0).gameObject; rewardWeapon.weaponOwnership = playerNumber; rewardWeapon.GrabAndDestroy(playerInfo[playerNumber].PlayerController); }
//--------------------------------------------------------------------------------------- private void OnTriggerStay2D(Collider2D collision) { if (isAlive) { if (collision.CompareTag("EnergyDispenser") && canHeal && Input.GetButtonDown(inputMapping.interactInput)) { collision.GetComponent <HealStation>().UseStation(GetComponent <_CharacterController>()); } if (collision.CompareTag("Weapon") && Input.GetButtonDown(inputMapping.interactInput)) { Weapon3D weapon = collision.GetComponent <Weapon3D>(); if (!weapon.isGrabbed) { weapon.hand = playerRightArm.transform.GetChild(0).gameObject; weapon.weaponOwnership = playerNumber; weapon.GrabAndDestroy(this); GMController.instance.TensionThresholdCheck(GMController.instance.tensionStats.actionsPoints); // add tension points for action } } if (collision.CompareTag("Key") && Input.GetButtonDown(inputMapping.interactInput)) { Weapon3D key = collision.GetComponent <Weapon3D>(); if (!key.isGrabbed) { key.hand = playerRightArm.transform.GetChild(0).gameObject; key.weaponOwnership = playerNumber; key.GrabAndDestroy(this); hasKey = true; } } if (collision.CompareTag("Exit") && hasKey) { canExit = true; } } }