// void DropObject () // { // // Is there a droppable container? // Collider col = UICamera.lastHit.collider; // TopicContainer container = (col != null) ? col.gameObject.GetComponent<TopicContainer>() : null; // // if (container != null && container.IsEmpty()) // { // container.CheckIfCorrectTopic(this); // Vector3 pos = container.transform.position; // pos.z = transform.position.z; // transform.position = pos; // droppedInContainer = true; // myContainer = container; // } // else // { // ReturnToBubble(); // } // } // void OnDrop(GameObject topic){ // containedTopic = topic.GetComponent<TopicSlotButton>(); // // if(IsEmpty()) // { // CheckIfCorrectTopic(containedTopic); // Vector3 pos = transform.position; // pos.z = containedTopic.transform.position.z; // containedTopic.transform.position = pos; // containedTopic.droppedInContainer = true; // containedTopic.myContainer = this; // } // // else // { // containedTopic.ReturnToBubble(); // containedTopic = null; // } // } public bool CheckIfCorrectTopic(TopicSlotButton topic) { // if(FoundCorrectTopic(topicName)) // animSelect = AnimationSelect.CORRECTANIM; // else // animSelect = AnimationSelect.INCORRECTANIM; // containedTopic = topic; if(FoundCorrectTopic(topic.name)) { InvokeRepeating("CorrectAnimation", 0f, 0.5f); animSelect = AnimationSelect.CORRECTANIM; Invoke("CancelAnim", 2f); manager.GotCorrectAnswer(); return true; } else { InvokeRepeating("IncorrectAnimation", 0f, 0.5f); animSelect = AnimationSelect.INCORRECTANIM; Invoke("CancelAnim", 2f); return false; } }
void Awake() { animCtrl = GetComponent <Animator>(); animSelect = AnimationSelect.Idle; }