コード例 #1
0
    private void Miner_EmptyCargo()
    {
        float wardedCargoValue = 0;

        for (int i = 0; i < _vehicle_Module_List._storageModuleList.Count; i++)
        {
            wardedCargoValue += _vehicle_Module_List._storageModuleList[i].GetCurrentCargoWeight();
            _vehicle_Module_List._storageModuleList[i].EmptyCargo();
        }
        _currentStorageModule = 0;
        Space_Station_Script sss = _closestSpaceStation.GetComponent <Space_Station_Script>();

        sss.Unload_Cargo(wardedCargoValue);
        if (_debugSelect)
        {
            Debug.Log("@Home, unloading rewarding " + wardedCargoValue);
        }
    }
コード例 #2
0
    /// <summary>
    /// This function links Miner vehicle to closest space station. Also sets base location near it.
    /// </summary>
    private void Miner_FindAndLinkClosestSpaceStation()
    {
        GameObject[] goList          = GameObject.FindGameObjectsWithTag("Space_Station_Linkable");
        float        closestDistance = Mathf.Infinity;

        foreach (GameObject go in goList)
        {
            if (Vector3.Distance(this.transform.position, go.transform.position) < closestDistance)
            {
                closestDistance      = Vector3.Distance(this.transform.position, go.transform.position);
                _closestSpaceStation = go;
            }
        }

        Space_Station_Script sss = _closestSpaceStation.GetComponent <Space_Station_Script>();

        sss.Space_Station_Link_Vehicle(gameObject);
        _baseLocation = _closestSpaceStation.transform.position;
        if (_debugSelect)
        {
            Debug.Log("Linked " + gameObject.name + " -> " + _closestSpaceStation.name);
        }
    }