// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); lineFollowingMouse = false; lineObjs = new LineRenderer[4]; ingredientObj = Instantiate(manager.recipe.ingredients[manager.curMinigame], new Vector3(0, 0, 1), Quaternion.identity, manager.activeMinigame) as LightIngredient; for (int c = 0; c < 4; c++) { lineObjs[c] = Instantiate(lines[c], Vector3.zero, Quaternion.identity, manager.activeMinigame) as LineRenderer; lineObjs[c].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; lineObjs[c].receiveShadows = true; lineObjs[c].startWidth = .05f; lineObjs[c].endWidth = .05f; lineObjs[c].enabled = false; } numClicks = 0; points = new List <Vector2>(); timing = false; revealTimer = 0f; source = GetComponent <AudioSource>(); source.volume = 1.0f; source.clip = tick; if (!manager.lightScenePlayed) { arrowPositions = new Vector3[8]; for (int c = 0; c < 8; c++) { Vector3 curPos = new Vector3(); curPos.z = -1f; if (c < 2) { curPos.x = ingredientObj.GetComponent <Collider2D>().bounds.extents.x * -.6f; } else if (c < 4) { curPos.x = ingredientObj.GetComponent <Collider2D>().bounds.extents.x * -.2f; } else if (c < 6) { curPos.x = ingredientObj.GetComponent <Collider2D>().bounds.extents.x * .2f; } else if (c < 8) { curPos.x = ingredientObj.GetComponent <Collider2D>().bounds.extents.x * .6f; } if (c % 2 == 0) { curPos.y = ingredientObj.GetComponent <Collider2D>().bounds.extents.y + .8f; } else { curPos.y = -ingredientObj.GetComponent <Collider2D>().bounds.extents.y - .8f; } curPos.x += arrow.GetComponent <Collider2D>().bounds.extents.x; curPos.y += arrow.GetComponent <Collider2D>().bounds.extents.y; arrowPositions[c] = curPos; } arrowObj = Instantiate(arrow, arrowPositions[0], Quaternion.identity, manager.activeMinigame); } }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); ingredientsAdded = 0; carryingIngredient = false; score = 1f; ingredientObjs = new Ingredient[3]; cauldronObj = Instantiate(cauldron, new Vector3(0.0f, -1.8f, 0.0f), Quaternion.identity, manager.activeMinigame) as GameObject; cauldronObj.transform.localScale = new Vector3(3.0f, 3.0f, 3.0f); ladleObj = Instantiate(ladle, Vector3.zero, Quaternion.identity, manager.activeMinigame) as GameObject; GameObject otherCauldronObj = Instantiate(otherCauldron, new Vector3(0.0f, -1.8f, 0.0f), Quaternion.identity, manager.activeMinigame) as GameObject; otherCauldronObj.transform.localScale = new Vector3(3.0f, 3.0f, 3.0f); for (int c = 0; c < 3; c++) { ingredientObjs[c] = Instantiate(manager.recipe.ingredients[c], new Vector3(-8, 2 - (c * 2), 0), Quaternion.identity, manager.activeMinigame) as Ingredient; ingredientObjs[c].transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } stirringDoneAmount = 0f; lastPos = new Vector2(10000, 10000); source = GetComponent <AudioSource>(); source.Play(); timing = false; revealTimer = 0f; potionScoreAmount = 0f; canClickDone = true; }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); ingredient = Instantiate(manager.recipe.ingredients[manager.curMinigame], new Vector3(0, 0, 1), Quaternion.identity, manager.activeMinigame) as SolidIngredient; sprite = ingredient.GetComponent <SpriteRenderer>(); lines = new List <GameObject>(); lineCount = 0; source = gameObject.GetComponent <AudioSource>(); //top left to top right float counter = -3.0f; while (counter <= 3) { temp = new Vector2(counter, 3); squarePath.Add(temp); counter += .3f; //Debug.Log("1" + temp); } //top right to bottom right counter = 3.0f; while (counter >= -3) { temp = new Vector2(3, counter); squarePath.Add(temp); counter -= .3f; //Debug.Log("2" + temp); } //bottom right to bottom left counter = 3.0f; while (counter >= -3) { temp = new Vector2(counter, -3); squarePath.Add(temp); counter -= .3f; //Debug.Log("3" + temp); } //bottom left to top left counter = -3.0f; while (counter <= 3) { temp = new Vector2(-3, counter); squarePath.Add(temp); counter += .3f; //Debug.Log("4" + temp); } timing = false; }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); anvilObj = Instantiate(anvil, new Vector3(Random.Range(-6.0f, 6.0f), 5, -1), Quaternion.identity, manager.activeMinigame) as GameObject; shadowObj = Instantiate(shadow, anvilObj.transform.position, Quaternion.identity, manager.activeMinigame) as GameObject; shadowObj.transform.localScale = new Vector3(0.05f, 0.05f, 1f); anvilCollider = anvilObj.GetComponent <Collider2D>(); ingredientObj = Instantiate(manager.recipe.ingredients[manager.curMinigame], new Vector3(0, -4, 0), Quaternion.identity, manager.activeMinigame) as LiquidIngredient; ingredientObj.transform.localScale = new Vector3(.3f, .3f, .3f); ingredientCollider = ingredientObj.GetComponent <Collider2D>(); xAccel = 0f; update = true; timing = false; revealTimer = 0f; }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); ingredientObj = Instantiate(manager.recipe.ingredients[manager.curMinigame], new Vector3(0, 0, 1), Quaternion.identity, manager.activeMinigame) as DustIngredient; s_renderer = ingredientObj.GetComponent <SpriteRenderer>(); source = GetComponent <AudioSource>(); source.volume = 1.0f; source.clip = hammerDink; height = s_renderer.bounds.size.y; width = s_renderer.bounds.size.x; minDistance = float.MaxValue; points = new List <Marker>(); setUpPoints(); var main = ps.main; main.startColor = dustColor; keepTimeZero = false; }
// Start is called before the first frame update void Start() { manager = GameObject.Find("GameManager").GetComponent <OverallManager>(); // Creates ingredient ingredient = Instantiate(manager.recipe.ingredients[manager.curMinigame], Vector3.zero, Quaternion.Euler(0, 0, 0)) as HerbIngredient; ingredient.transform.parent = GameObject.Find("ActiveMinigame").transform; // The X bounds of the sprite xBounds = ingredient.GetComponent <SpriteRenderer>().bounds.size.x; // Reset timer timer = 0f; // Centers ingredient ingredient.transform.position = new Vector3(0, 0, 0); // Creates all of the lines for (int i = 0; i < 4; i++) { gameCutSpots.Add(Instantiate(line2, new Vector3((float)((random.NextDouble() * xBounds)) - (xBounds / 2), 0, -1), Quaternion.Euler(0, 0, 0))); playerCutSpots.Add(Instantiate(line1, new Vector3(20, 0, -1), Quaternion.Euler(0, 0, 0))); playerCutSpots[i].SetActive(false); gameCutSpots[i].transform.parent = GameObject.Find("ActiveMinigame").transform; playerCutSpots[i].transform.parent = GameObject.Find("ActiveMinigame").transform; // Checks the game cuts line positons CheckPositions(); } ingredient.gameObject.SetActive(false); // Make the ingredient invisible ToggleVisiblity(); // Toggles the lines visibility // Sets up audio audio = GetComponent <AudioSource>(); audio.volume = 1.0f; keepTimeZero = false; }
public void ResumeButton() { OverallManager.Pause(); }