示例#1
0
    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());
    }
示例#2
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());
    }
示例#3
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;
    }
示例#4
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>();
        _stockpileArea = GameObject.Find("StockpileArea").GetComponent <StockpileArea>();
        _interactor    = GetComponent <PetInteractor>();
        _sounds        = GetComponent <PetSounds>();

        StartCoroutine(Tick());
    }
 void Awake()
 {
     petScript = GetComponent <PetMovement>();
 }
示例#6
0
 public void Start()
 {
     petAnimationScript = gameObject.GetComponentInChildren <PetMovement>();
     petMovement        = gameObject.GetComponentInParent <PetBasicAI>();
 }
示例#7
0
 void Start()
 {
     _petMovement = GetComponent <PetMovement>();
     _sounds      = GetComponent <PetSounds>();
 }
示例#8
0
 // Use this for initialization
 void Start()
 {
     pet = GetComponentInParent <PetMovement>();
 }