Created
January 27, 2023 09:12
-
-
Save Mazday21/6568f1bbb81ecccb510807fb2a9abc33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField] private Weapon[] _weapons; | |
private Transform[] _transformsWeapon; | |
private void Start() | |
{ | |
for(int i = 0; i < _weapons.Length; i++) | |
{ | |
_transformsWeapon[i] = _weapons[i].transform; | |
} | |
} | |
public void ReturnGameObject(GameObject gameObject) | |
{ | |
Weapon weapon = gameObject.GetComponent<Weapon>(); | |
for(int i = 0; i < _weapons.Length; i++) | |
{ | |
if (_weapons[i] == weapon) | |
{ | |
gameObject.transform.rotation = _transformsWeapon[i].rotation; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment