Пример #1
0
    private void PlantSeed()
    {
        //play seed drop audio
        sAudio.clip = seedPlant;
        sAudio.Play();
        //instantiate tree in front of player
        Vector3 flatForward = Camera.main.transform.forward;

        flatForward.y = 0;
        Vector3 newPos = transform.position + flatForward.normalized;

        newPos.y -= transform.localPosition.y; //this should be based on terrain height
        Instantiate(treePrefab, newPos, Quaternion.identity);
        //subtract number of seeds
        sItem.Planted();
    }