public void SetObjective(PackageController _package) { m_objective = _package; if (m_objectiveProxy == null) { return; } if (m_objective == null) { m_objectiveProxy.gameObject.SetActive(false); timerText.gameObject.SetActive(false); GetComponent <Collider>().enabled = false; } else { GetComponent <Collider>().enabled = true; timerText.gameObject.SetActive(true); m_objectiveProxy.gameObject.SetActive(true); m_objectiveProxy.SetShape(m_objective.GetShape()); m_objectiveProxy.SetColor(m_objective.GetColor()); m_objectiveProxy.SetLayout(m_objective.GetLayout()); m_objectiveExpirationTimer = objectiveExpirationTime; } }
private void OnTriggerEnter(Collider other) { PackageController package = other.GetComponent <PackageController>(); if (package && package.canValidateWinCondition) { if (package.GetShape() == m_objectiveProxy.GetShape() && package.GetColor() == m_objectiveProxy.GetColor() && package.GetLayout() == m_objectiveProxy.GetLayout()) { if (OnValidPackage != null) { OnValidPackage(this, package); } PackageController newPackage = FindValidObjective(); SetObjective(newPackage); } else { if (OnInvalidPackage != null) { OnInvalidPackage(this, package); } } package.PrettyDestroy(); package.canValidateWinCondition = false; } }