Exemplo n.º 1
0
 void Awake()
 {
     life         = GetComponent <PlantLife> ();
     seq          = GetComponent <playSequence> ();
     neighbours   = life.neighbourPos;
     neighbourObj = new GameObject[6];
     ybump        = new Vector3(0, 1, 0);
 }
Exemplo n.º 2
0
 void Awake()
 {
     seq     = GetComponent <AudioHelm.Sequencer>();
     playSeq = GetComponent <playSequence>();
     //grabs Sun ref
     neighbourPos = new Vector3[6];
     bed          = GameObject.FindGameObjectWithTag("Bed");
     sleepScript  = bed.GetComponent <Bed>();
 }
Exemplo n.º 3
0
    void Start()
    {
        playAud = GetComponent <playSequence>();
        //grabs Audio
        treeSounds = gameObject.AddComponent <AudioSource>();
        //TerrainGridSystem ref
        tgs            = TerrainGridSystem.instance;
        randomRotation = 60 * Random.Range(0, 6);
        // Clone Sapling prefabs and Instantiate
        groundTile = tgs.CellGetAtPosition(transform.position, true);
        //transform.SetParent ();
        cellIndex = tgs.CellGetIndex(groundTile);
        neighbors = tgs.CellGetNeighbours(groundTile);
        tgs.CellSetCanCross(cellIndex, false);
        //fills up neighborIndexes with the proper cell indexes
        for (int i = 0; i < neighbors.Count; i++)
        {
            int index = tgs.CellGetIndex(neighbors[i]);
            neighborIndexes.Add(index);
            neighbourPos[i] = tgs.CellGetPosition(index);
            //this gives you neighbor cell position
            //can be used to see which cell you’re being given
            //raycast to this position to get the plant collider and get the sequencer
            if (tgs.CellGetTag(index) == 2)
            {
                //this cell has a tree planted, but don’t run this in start
                //send to an array of “plants nearby”

                //for any rule make a bool in plantlife for “isFollowingRule” to see if neighbours are occupied or following a rule already
                //are two adjacent cells in the index occupied that’s a triad
                //if all cells are occupied that’s an arp, arp beats triad
            }
        }
        if (plantedInEditor)
        {
            ageCounter        -= 1;
            transform.position = tgs.CellGetPosition(cellIndex);
            tgs.CellSetTag(cellIndex, 2);
            tgs.CellToggleRegionSurface(cellIndex, true, growingTexture);
        }
        else
        {
            //Set age and fruit
            ageCounter  = 0;
            fruitAmount = 0;
            growthDay   = 1;
        }
        StartCoroutine(Growth());
    }