Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        _petMovement = GetComponent <PetMovement>();
        _jellyMesh   = GetComponent <JellyMesh>();
        _renderer    = GetComponent <MeshRenderer>();
        _animator    = GetComponent <Animator>();
        _foodSpawner = GameObject.Find("FoodSpawner").GetComponent <FoodSpawner>();
        _interactor  = GetComponent <PetInteractor>();
        _sounds      = GetComponent <PetSounds>();
        _stats       = GetComponent <PetStats>();

        string debugActionList = "";

        // Use reflection to find every type that inherits from BasePetAction, instansiate it, and stick it in _actions
        foreach (var type in System.AppDomain.CurrentDomain.GetAllDerivedTypes(typeof(BasePetAction)))
        {
            var action = (BasePetAction)Activator.CreateInstance(type);
            action.Init(gameObject);
            _actions.Add(action);
            debugActionList += type.ToString() + " ";
        }

        Debug.Log("Loaded " + _actions.Count + " pet actions: " + debugActionList);

        StartCoroutine(Tick());
    }
Esempio n. 2
0
    /// <summary>
    /// Pull the relevant scripts from the Pet gameobject, called once at start of game
    /// </summary>
    /// <param name="pet"></param>
    public void Init(GameObject pet)
    {
        _petMovement   = pet.GetComponent <PetMovement>();
        _foodSpawner   = GameObject.Find("FoodSpawner").GetComponent <FoodSpawner>();
        _stockpileArea = GameObject.Find("StockpileArea").GetComponent <StockpileArea>();
        _interactor    = pet.GetComponent <PetInteractor>();
        _sounds        = pet.GetComponent <PetSounds>();
        _stats         = pet.GetComponent <PetStats>();
        _observer      = pet.GetComponent <PetObserver>();

        this._pet = pet;
    }
Esempio n. 3
0
 private void SetUpSingleton()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         if (instance != this)
         {
             Destroy(gameObject);
         }
     }
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 4
0
 void Start()
 {
     hungerBar.transform.localPosition = new Vector2(fullBar, hungerBar.transform.localPosition.y);
     stats = pet.GetComponent <PetStats>();
 }
Esempio n. 5
0
 // Start is called before the first frame update
 void Start()
 {
     itemID   = 0; // kai bus item database sita fix
     itemTick = baseTick;
     petStats = this.gameObject.GetComponent <PetStats>();
 }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     action   = gameObject.GetComponent <ActionScript>();
     petstats = GameObject.Find("Gameplay manager").GetComponent <PetStats>();
 }
 public void PetTrophyBttn()
 {
     PetStats.SetActive(false);
     PetInv.SetActive(false);
     PetTrophy.SetActive(true);
 }
Esempio n. 8
0
 void Start()
 {
     _petBrain = GetComponent <PetBrain>();
     _petStats = GetComponent <PetStats>();
     StartCoroutine(CheckForTrill());
 }
Esempio n. 9
0
    [SerializeField] float _wanderChangeRate; // how fast the wander heading changes in the direction

    // Start is called before the first frame update
    void Start()
    {
        _jellyMesh = GetComponent <JellyMesh>();
        _stats     = GetComponent <PetStats>();
    }
Esempio n. 10
0
 void Start()
 {
     stats = pet.GetComponent <PetStats>();
 }
Esempio n. 11
0
 // Use this for initialization
 void Start()
 {
     pStats = GetComponent<PetStats>();
 }
Esempio n. 12
0
    void Start()
    {
        myPetObject = this.gameObject;

        FOV = transform.FindChild("PetFOV").GetComponent<PetFieldOfView>();

        petStats = GameObject.Find("PetGarden").GetComponent<PetStats>();
        petBelly = GameObject.Find("PetGarden").GetComponent<PetBelly>();
        petInventory = GameObject.Find("PetGarden").GetComponent<Inventory>();

        myEnergy = petBelly.GetMaxEnergy();
    }
Esempio n. 13
0
 // Start is called before the first frame update
 void Start()
 {
     petStats = gameObject.GetComponent <PetStats>();
     pet      = GameObject.FindGameObjectWithTag("Pet");
 }
Esempio n. 14
0
 // Start is called before the first frame update
 void Start()
 {
     touched  = gameObject.GetComponent <ActionScript>();
     petstats = GameObject.Find("Gameplay manager").GetComponent <PetStats>();
     hp       = Random.Range(2, 10);
 }