void DragEnd(OTObject owner) { GameObject.Find("DragEnd").GetComponent <Renderer>().enabled = true; if (main.onlyOnPurple) { if (owner.dropTarget == null || owner.dropTarget.name != "draggable sprite purple") { // invalidate this drop by setting target to null owner.dropTarget = null; return; } } if (owner.dropTarget != null) { GameObject.Find("DragEnd").GetComponent <TextMesh>().text = "Drag Ended - dropped on " + owner.dropTarget.name; } else { GameObject.Find("DragEnd").GetComponent <TextMesh>().text = "Drag Ended"; } OTDebug.Message(GameObject.Find("DragEnd").GetComponent <TextMesh>().text); ended = true; }
void DragStart(OTObject owner) { GameObject.Find("DragStart").renderer.enabled = true; GameObject.Find("Dragging").renderer.enabled = false; GameObject.Find("DragEnd").renderer.enabled = false; ended = false; endTimer = 0; OTDebug.Message("start dragging " + owner.name); }
void DragStart(OTObject owner) { GameObject.Find("DragStart").GetComponent <Renderer>().enabled = true; GameObject.Find("Dragging").GetComponent <Renderer>().enabled = false; GameObject.Find("DragEnd").GetComponent <Renderer>().enabled = false; ended = false; endTimer = 0; GameObject.Find("DragStart").GetComponent <TextMesh>().text = "start dragging " + owner.name; OTDebug.Message("start dragging " + owner.name); }
void ReceiveDrop(OTObject owner) { if (main.lockPurple && sprite.name == "draggable sprite purple") { // invalidate this drop by setting target to null owner.dropTarget = null; return; } GameObject.Find("Dragging").GetComponent <TextMesh>().text = owner.name + " received drop from " + owner.dropTarget.name; OTDebug.Message(GameObject.Find("Dragging").GetComponent <TextMesh>().text); }
void DragEnd(OTObject owner) { GameObject.Find("DragEnd").renderer.enabled = true; if (owner.dropTarget != null) { GameObject.Find("DragEnd").GetComponent <TextMesh>().text = "Drag Ended - dropped on " + owner.dropTarget.name; } else { GameObject.Find("DragEnd").GetComponent <TextMesh>().text = "Drag Ended"; } OTDebug.Message(GameObject.Find("DragEnd").GetComponent <TextMesh>().text); ended = true; }
public Material GetMat() { Material mat = OT.LookupMaterial(lastMatName); if (mat != null) { OTDebug.Message("GetMat -> Found", "ot-mat"); otRenderer.material = mat; HandleUV(); } else { OTDebug.Message("GetMat -> Not Found", "ot-mat"); mat = InitMaterial(); } OTDebug.Message("@OT.MatInc - GetMat()", "ot-mat"); OT.MatInc(mat, lastMatName); lastMat = mat; return(mat); }
protected virtual Material InitMaterial() { OTDebug.Message("@-->InitMaterial-In()", "ot-mat"); if (spriteContainer != null && !spriteContainer.isReady) { // if we have a non-ready sprite container // lets use the current assigned and scene saved material lastMat = material; assignedMaterial = false; isDirty = true; return(lastMat); } // correct _frameIndex if (spriteContainer != null && _frameIndex > spriteContainer.frameCount - 1) { _frameIndex = spriteContainer.frameCount - 1; } // Get the new material base instance Material spMat = OT.GetMaterial(_materialReference, tintColor, alpha); // If we couldn't generate the material lets take our 'default' transparent if (spMat == null) { spMat = OT.materialTransparent; } if (spMat == null) { return(null); } // lets create a unique material instance belonging to this // material name. This will be cached so other sprites that use // the same material name will use the same and will get batched // automaticly Material mat = new Material(spMat); if (spriteContainer != null && spriteContainer.isReady) { // setup the sprite material hooked to the sprite container Texture tex = spriteContainer.GetTexture(); if (mat.mainTexture != tex) { mat.mainTexture = tex; } mat.mainTextureScale = Vector2.one; mat.mainTextureOffset = Vector2.zero; HandleUV(); } else if (image != null) { // setup the sprite material hooked to the image texture if (mat != null) { mat.mainTexture = image; mat.mainTextureScale = Vector2.one; mat.mainTextureOffset = Vector3.zero; } } if (mat != null) { // if we had a previous created material assigned we have to decrease // the material cache count if (lastMatName != "" && lastMat != null) { OT.MatDec(lastMat, lastMatName); } // because we are recreating the material the first time // we will have to destroy the current material or it // will start floating if (lastMat == null && !assignedMaterial && !isCopy) { if (GetComponent <Renderer>() != null) { if (!Application.isPlaying) { DestroyImmediate(otRenderer.sharedMaterial, true); } else { Destroy(otRenderer.material); } } } // assign the new material to the renderer if (Application.isPlaying) { otRenderer.material = mat; } else { otRenderer.sharedMaterial = mat; } // store this material as the last material lastMat = mat; lastMatName = GetMatName(); // we created/cached this material so it was not assigned assignedMaterial = false; } OTDebug.Message("@<--InitMaterial()", "ot-mat"); return(mat); }
void ReceiveDrop(OTObject owner) { GameObject.Find("Dragging").GetComponent <TextMesh>().text = owner.name + " received drop from " + owner.dropTarget.name; OTDebug.Message(GameObject.Find("Dragging").GetComponent <TextMesh>().text); }