private void Awake()
    {
        ResourcesManagerBehaviour.Visibles  = new List <GameObject>();
        ResourcesManagerBehaviour.Resources = new List <GameObject>();

        ResourcesManagerBehaviour.Wood = new WoodResource();
        ResourcesManagerBehaviour.Food = new FoodResource();

        ResourcesManagerBehaviour.Self = this;
    }
コード例 #2
0
    void Awake()
    {
        tokens = FindObjectOfType <Tokens>();

        woodResourceGO   = GameObject.FindGameObjectWithTag("Player Wood Resource");
        woodResourceCode = woodResourceGO.GetComponent <WoodResource>(); // FindObjectOfType<WoodResource>();

        lumberMillGO   = GameObject.FindGameObjectWithTag("Player Lumber Mill");
        lumberMillCode = lumberMillGO.GetComponent <LumberMillPlayer>(); // FindObjectOfType<LumberMill>();

        worker = workerGO.GetComponent <Worker>();

        lumberMillPos = lumberMillGO.transform.position;
        woodPos       = woodResourceGO.transform.position;
    }
コード例 #3
0
    void OnEnable()
    {
        EventManager.StartListening("AIWorkerArrivedAtWoodResource", AIWorkerArrivedAtWoodResourceEvent);
        EventManager.StartListening("AIWorkerArrivedAtLumberMill", AIWorkerArrivedAtLumberMillEvent);

        // let's find the wood's position by tag - in the future we should find the closest one out of the array, also on the wood resource if they've been harvested, then take them out of the array, use "FindGameObjectsByTag" to put multiple game objects into the array

        woodResourceGO   = GameObject.FindGameObjectWithTag("AI Wood Resource");
        woodResourceCode = woodResourceGO.GetComponent <WoodResource>(); // FindObjectOfType<WoodResource>();

        // these might have to wait until we build the lumber mill, so a lumber mill built event

        lumberMillGO   = GameObject.FindGameObjectWithTag("AI Lumber Mill");
        lumberMillCode = lumberMillGO.GetComponent <LumberMillAI>(); // FindObjectOfType<LumberMill>(); // we will need to find the appropriate lumber mill later

        workerAI      = this.GetComponent <WorkerAI>();
        woodPos       = woodResourceGO.transform.position;
        lumberMillPos = lumberMillGO.transform.position;
        workerAI.Move(woodPos);
    }
コード例 #4
0
 private void AddResource(ref WoodResource wood)
 {
     woodResources.Add(ref wood);
 }
コード例 #5
0
 protected void AddResource(ref WoodResource wood)
 {
     woodResources.Add(ref wood);
 }