private void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "PickItem") { //if (pick_collect == null) return; if (picking_item != null && collision.gameObject == picking_item.gameObject) { //Debug.Log("the same"); picking_item.GetComponent <COutLine>().SetOutLine(false); picking_item = null; ChangeSlot(true, 0); if (can_pick) { can_pick = false; } } //if (can_pick) can_pick = false; } if (can_collect && collision.tag == "PickCollection") { //Debug.Log("LEAVE COLLECT"); //if (pick_collect == null) return; if (pick_collect != null && collision.gameObject == pick_collect.gameObject) { pick_collect.GetComponent <COutLine>().SetOutLine(false); can_collect = false; pick_collect = null; } } }
private void OnTriggerStay2D(Collider2D collision) { //Debug.Log("collision stay" + collision.name); if (collision.tag == "PickItem") { if (!can_pick && !can_collect && craftFunc) { //Debug.Log("empty"); picking_item = collision.GetComponent <CPickItem>(); picking_item.GetComponent <COutLine>().SetOutLine(true); if (!b_handling) { ChangeSlot(false, picking_item.id); } else { craftB = items[picking_item.id]; CheckCrafting(); } can_pick = true; } } else if (!can_collect && collision.tag == "PickCollection" && !can_pick && craftFunc) { can_collect = true; pick_collect = collision.transform.GetComponent <CPickCollection>(); pick_collect.GetComponent <COutLine>().SetOutLine(true); } }
private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log("enter"); if (collision.tag == "PickItem") { if (!can_pick && !can_collect && craftFunc) { picking_item = collision.gameObject.GetComponent <CPickItem>(); picking_item.GetComponent <COutLine>().SetOutLine(true); if (!b_handling) { //Debug.Log("going to pick"); ChangeSlot(false, picking_item.id); } else { //Debug.Log("going to craft"); craftB = items[picking_item.id]; CheckCrafting(); } can_pick = true; } } else if (!can_collect && collision.tag == "PickCollection" && !can_pick) { if (!craftFunc) { return; } can_collect = true; pick_collect = collision.transform.GetComponent <CPickCollection>(); pick_collect.GetComponent <COutLine>().SetOutLine(true); //Debug.Log(pick_collect.gameObject.name); } }
IEnumerator OnCollecting() { //Debug.Log(this.gameObject.name + "coroutine"); can_collect = false; craftFunc = false; float time = 0.0f; collectBarBk.GetComponent <SpriteRenderer>().enabled = true; collectBar.GetComponent <SpriteRenderer>().enabled = true; while (time < 1.0f) { time += Time.deltaTime * 1.25f; collectBar.localScale = new Vector3(Mathf.Lerp(0.0f, 1.05f, time), 0.1f, 1.0f); yield return(null); } crafterAnimator.SetBool("is_gather", false); collectBarBk.GetComponent <SpriteRenderer>().enabled = false; collectBar.GetComponent <SpriteRenderer>().enabled = false; switchMove(true); pick_collect.ThrowItemOut(); pick_collect = null; craftFunc = true; if (test) { tutorialRequest.DoneCollect(); } }
void CollectOver() { //crafterAnimator.SetBool("is_gather", false); collectBarBk.GetComponent <SpriteRenderer>().enabled = false; collectBar.GetComponent <SpriteRenderer>().enabled = false; pick_collect.ThrowItemOut(); pick_collect = null; craftFunc = true; }
public Vector3 SetThunderLoc() { for (int i = 0; i < usedCollectList.childCount; i++) { CPickCollection pickCollection = usedCollectList.GetChild(i).GetComponent <CPickCollection>(); if (pickCollection.CanOnFire()) //&& Random.Range(0.0f, 1.0f) > 0.85f) { fireTree = pickCollection; fireTree.StartFire(); return(pickCollection.transform.position); } } return(new Vector3(-60.0f, 0.0f, 0.0f)); }