Created
April 23, 2015 22:47
-
-
Save suakig/a9c11dc9995fd355a1c7 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
using UnityEngine; | |
using System.Collections; | |
public class Weapon : MonoBehaviour { | |
[System.NonSerialized] public GameObject whoEquip; | |
Gun[] gun; | |
void Start () | |
{ | |
Transform parent = transform.parent; | |
while (parent != null) { | |
if (parent.GetComponent<Equipment> ()) { | |
whoEquip = parent.gameObject; | |
break; | |
} | |
parent = parent.parent; | |
} | |
gun = this.transform.GetComponentsInChildren<Gun> (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment