コード例 #1
0
    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;
        }
    }
コード例 #2
0
ファイル: CloudPlow.cs プロジェクト: Solek798/Tree-of-Dreams
    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);
        }
    }
コード例 #3
0
 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;
         }
     }
 }
コード例 #4
0
ファイル: SeedFlute.cs プロジェクト: Solek798/Tree-of-Dreams
    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);
    }
コード例 #5
0
    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());
    }
コード例 #6
0
    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;
    }
コード例 #7
0
    public bool IsUsable(FarmlandSpace space)
    {
        var plant = space.Plant;

        return(plant != null && plant.IsReadyToHarvest());
    }
コード例 #8
0
ファイル: CloudPlow.cs プロジェクト: Solek798/Tree-of-Dreams
 public bool IsUsable(FarmlandSpace space)
 {
     return(isInUse == false && space.Lampion == null && space.Plant == null);
 }
コード例 #9
0
ファイル: CloudPlow.cs プロジェクト: Solek798/Tree-of-Dreams
    IEnumerator AnimationEnds(FarmlandSpace space)
    {
        yield return(new WaitForSeconds(space.animator.GetCurrentAnimatorStateInfo(0).length - 0.5f));

        isInUse = false;
    }
コード例 #10
0
ファイル: SeedFlute.cs プロジェクト: Solek798/Tree-of-Dreams
 public bool IsUsable(FarmlandSpace space)
 {
     return(space.IsSoil && space.Plant == null);
 }
コード例 #11
0
 public bool IsUsable(FarmlandSpace space)
 {
     return(space.IsSoil);
 }