public void Notify(AgentNotificationType type) { if (manager.showNotifications) { GetComponent <AgentNotifier>().Notify(type); } }
public void Notify(AgentNotificationType type) { if (inProgress) { return; } inProgress = true; if (_notifierPlane == null) { Quaternion rotation = Quaternion.identity; rotation.eulerAngles = new Vector3(0, 180, 0); _notifierPlane = Instantiate(notifierPlanePrefab, transform.position, rotation) as GameObject; _notifierPlane.transform.parent = transform; _myMaterial = new Material(_notifierPlane.renderer.material); _notifierPlane.renderer.material = _myMaterial; } _notifierPlane.transform.localScale = Vector3.zero; _notifierPlane.transform.position = transform.position; if (type == AgentNotificationType.Sex) { _myMaterial.mainTexture = sexTexture; } else if (type == AgentNotificationType.Birth) { _myMaterial.mainTexture = birthTexture; } else if (type == AgentNotificationType.Pregnant) { _myMaterial.mainTexture = pregnantTexture; } else if (type == AgentNotificationType.Puberty) { _myMaterial.mainTexture = pubertyTexture; } else if (type == AgentNotificationType.Death) { _myMaterial.mainTexture = deathTexture; } else if (type == AgentNotificationType.Ate) { _myMaterial.mainTexture = ateTexture; } else if (type == AgentNotificationType.Murder) { _myMaterial.mainTexture = murderedTexture; } _notifierPlane.renderer.enabled = true; Vector3 destination = new Vector3(0, 4, 0); iTween.ScaleTo(_notifierPlane, new Vector3(7, 7, 7), notificationDuration); iTween.MoveTo(_notifierPlane, iTween.Hash("position", destination, "time", notificationDuration, "oncomplete", "NotifyDone", "islocal", true)); StartCoroutine(NotifyDone()); }