// Start is called before the first frame update
    void Start()
    {
        dogName      = GameObject.Find("Name").GetComponent <Text>();
        dogHappiness = GameObject.Find("Happiness").GetComponent <Text>();

        dog = this.transform.GetComponent <DogBehaviour>();
    }
    void placeDog(EnvironmentTile tile)
    {
        if (tile != null)
        {
            //Shpw the shop at the mouse position in the centre of the tile
            spawnedDog.transform.position = new Vector3(mRaycastHits[0].transform.position.x + 5, mRaycastHits[0].transform.position.y + 3, mRaycastHits[0].transform.position.z + 5);

            //Only place a dog if within a paddock and a dog isn't currently within that position
            if (Input.GetMouseButtonDown(0))
            {
                if (tile.isPaddock)
                {
                    if (currency.sufficientFunds(dogCost))
                    {
                        if (tile.GetComponentInParent <Paddock>().addDogs())
                        {
                            dogClone = dog.spawnDog();
                            dogClone.transform.position = tile.Position;

                            //Assign the paddock to the dog
                            dogB = dogClone.GetComponentInChildren <DogBehaviour>();
                            dogB.setTile(tile);
                            dogB.setPaddock(tile.GetComponentInParent <Paddock>().getPaddock());
                            dogB.setPaddockTiles(tile.GetComponentInParent <Paddock>().getPaddockTiles());

                            interactingPaddock = mRaycastHits[0].transform.GetComponentInParent <Paddock>().getPaddock();

                            placingDog = false;

                            currency.takeIncome(dogCost);
                            level.addExp(standardExp);
                        }
                    }
                }

                //Destroy stand in

                Destroy(spawnedDog.gameObject);

                placingDog = false;
            }
        }
    }
Beispiel #3
0
 private void Awake()
 {
     instance = this;
 }
Beispiel #4
0
 void Awake()
 {
     Instance = this;
 }