public void OnPointerEnter(PointerEventData eventData) { InspectPanelBehavior inspectManager = InspectPanelBehavior.Instance; inspectManager.gameObject.transform.position = Input.mousePosition; Animal animal; if (gameObject.GetComponent <Animal>()) { animal = (Animal)gameObject.GetComponent <Animal>(); inspectManager.SetImage(gameObject.GetComponent <Image> ().sprite); string attrText = "Stats"; attrText = attrText + "\nFighting: " + animal.GetAttributeScore("Fighting").ToString(); attrText = attrText + "\nStrength: " + animal.GetAttributeScore("Strength").ToString(); attrText = attrText + "\nTracking: " + animal.GetAttributeScore("Tracking").ToString(); attrText = attrText + "\nFood: " + animal.GetAttributeScore("Food").ToString(); inspectManager.SetAttrText(attrText); string traitText; traitText = animal.GetAge().ToString() + "\n"; traitText += animal.SizeTrait.name.ToString() + "\n"; traitText += animal.SpeciesTrait.name.ToString() + "\n"; foreach (BaseTrait t in animal.Traits) { traitText = traitText + t.name.ToString() + "\n"; } inspectManager.SetTraitText(traitText); inspectManager.gameObject.SetActive(true); } }
void Awake() { Instance = this; this.gameObject.SetActive(false); }