void Start() { if (instance == null) { instance = this; } else if (this != instance) { Destroy(gameObject); } // Para o pet poder continuar a realizar suas ações mesmo quando o jogador não estiver na cena com o pet DontDestroyOnLoad(gameObject); pet = gameObject.GetComponentInChildren <Pet>(); player = SaveManager.instance.player; petAnimationScript = gameObject.GetComponentInChildren <PetMovement>(); petHealth = SaveManager.instance.player.health; petAccessInfoIndex = PetAccessListSelection(); petAccessGraph = petAccessInfo[petAccessInfoIndex].CreateGraph(); IncreaseChanceCalculate(); StartCoroutine(PetActionVerifier()); }
// 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()); }
/// <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; }
// 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>(); _stockpileArea = GameObject.Find("StockpileArea").GetComponent <StockpileArea>(); _interactor = GetComponent <PetInteractor>(); _sounds = GetComponent <PetSounds>(); StartCoroutine(Tick()); }
void Awake() { petScript = GetComponent <PetMovement>(); }
public void Start() { petAnimationScript = gameObject.GetComponentInChildren <PetMovement>(); petMovement = gameObject.GetComponentInParent <PetBasicAI>(); }
void Start() { _petMovement = GetComponent <PetMovement>(); _sounds = GetComponent <PetSounds>(); }
// Use this for initialization void Start() { pet = GetComponentInParent <PetMovement>(); }