Exemple #1
0
    public static void CreateCompanyInfo(Encounter encounter = null, GameObject origin = null, GameObject destination = null)
    {
        CompanyInfo companyInfo = new CompanyInfo();

        companyInfo.targetEncounter = encounter;
        companyInfo.originSave      = TransformSave.StoreTransform(origin);
        companyInfo.destinationSave = TransformSave.StoreTransform(destination);
        encounter.selectedCompany   = companyInfo;
        companies.Add(companyInfo);
    }
Exemple #2
0
    private void Update()
    {
        if (!moving)
        {
            return;
        }
        else
        {
            bool endMove = false;
            MapUIManager.uiState = MapUIManager.UIState.noInput;

            if (companyInfo.targetEncounter == null)
            {
                Debug.LogWarning("No encounter to travel to, heading back");
                companyInfo.destination = MapManager.theCastle.transform;
            }

            transform.position = Vector3.MoveTowards(transform.position, companyInfo.destination.position, companyInfo.travelSpeed);

            //check to see if it has reached its destination.
            if (Vector3.Distance(transform.position, companyInfo.destination.transform.position) <= 0.01f)
            {
                companyInfo.currentLocationSave = TransformSave.StoreTransform(companyInfo.destination.gameObject);
            }

            timer += Time.deltaTime;
            if (timer > 1)
            {
                endMove = true;
            }

            if (endMove)
            {
                companyInfo.currentLocationSave = TransformSave.StoreTransform(gameObject);
                MapUIManager.uiState            = MapUIManager.UIState.standard;
                mapManager.CheckForAvailableEncounters();
                mapManager.ReturnCompanysToCastle();
                moving = false;
                timer  = 0;
                return;
            }
        }
    }