public IEnumerator Use(FarmlandSpace space) { if (!_isUsed) { _isUsed = true; var plant = space.Plant; int randInt = Random.Range(0, audioClips.Count - 1); audioPlayer.clip = audioClips[randInt]; audioPlayer.Play(); plant.animator.Play("HarvestingAnimation"); space.dreamSickleParticle.Play(); yield return(new WaitForSeconds(plant.animator.GetCurrentAnimatorStateInfo(0).length - 0.5f)); space.Plant = null; GetComponent <InventoryItem>().Inventory.PickUp(plant.gameObject); _isUsed = false; } }
public IEnumerator Use(FarmlandSpace space) { isInUse = true; if (space.IsSoil) { audioPlayer.clip = fillAudio; audioPlayer.Play(); space.animator.Play("SoilDespawnAnimation"); yield return(new WaitForSeconds(space.animator.GetCurrentAnimatorStateInfo(0).length - 0.5f)); space.UpdateState(); isInUse = false; yield return(space.IsSoil = false); } else { audioPlayer.clip = plowAudio; audioPlayer.Play(); space.animator.Play("SoilSpawnAnimation"); StartCoroutine(AnimationEnds(space)); yield return(space.IsSoil = true); } }
private void RingWhenArrived() { if (newLampion != null && targetSpace != null) { if ((int)newLampion.transform.position.x == (int)targetSpace.transform.position.x && (int)newLampion.transform.position.z == (int)targetSpace.transform.position.z) { audioPlayer.Play(); newLampion = null; targetSpace = null; } } }
public IEnumerator Use(FarmlandSpace space) { _space = space; var inventory = GetComponent <InventoryItem>().Inventory; if (inventory != null) { Debug.Log(Input.mousePosition); cropUi.transform.position = Input.mousePosition; cropUi.OpenUiMenu(inventory); } yield return(true); }
public IEnumerator Use(FarmlandSpace space) { space.bagOfStardustParticle.Play(); space.IsNurtured = true; if (space.Plant != null) { space.Plant.animator.Play("NurturingAnimation"); } int randInt = Random.Range(0, audioClips.Count - 1); audioPlayer.clip = audioClips[randInt]; audioPlayer.Play(); yield return(new WaitForEndOfFrame()); }
private void Send(Lampion _newLampion, FarmlandSpace _targetSpace) { newLampion = _newLampion; targetSpace = _targetSpace; // Select random spawn point newLampion.transform.localPosition = new Vector3(spawnRadius * Random.value, 0, 0); newLampion.transform.RotateAround( newLampion.transform.parent.position, Vector3.up, 360 * Random.value ); // send Lampion by setting TravelTarget targetSpace.Lampion = newLampion; newLampion.TravelTarget = targetSpace.transform.position; }
public bool IsUsable(FarmlandSpace space) { var plant = space.Plant; return(plant != null && plant.IsReadyToHarvest()); }
public bool IsUsable(FarmlandSpace space) { return(isInUse == false && space.Lampion == null && space.Plant == null); }
IEnumerator AnimationEnds(FarmlandSpace space) { yield return(new WaitForSeconds(space.animator.GetCurrentAnimatorStateInfo(0).length - 0.5f)); isInUse = false; }
public bool IsUsable(FarmlandSpace space) { return(space.IsSoil && space.Plant == null); }
public bool IsUsable(FarmlandSpace space) { return(space.IsSoil); }