Пример #1
0
    public void CloseCharacterInfo()
    {
        if (hasRaycastLock)
        {
            RaycastLock.GiveLock();
            hasRaycastLock = false;
        }

        CloseCharacterEdit();
        if (charToEdit != null)
        {
            charToEdit.GetComponent <Animator>().enabled = true;
        }
        if (navMeshWanderToEdit != null)
        {
            if (destinationDropDown.value == 0)
            {
                navMeshWanderToEdit.ConfigureDestination();
            }
            else
            {
                navMeshWanderToEdit.ConfigureDestination(destinationDropDown.value - 1);
            }
        }
        ApplyOptions();

        charToEdit          = null;
        navMeshWanderToEdit = null;
        charInfoOpen        = false;
        charInfoPanel.gameObject.SetActive(false);
    }
Пример #2
0
    public void OpenCharacterInfo()
    {
        Destroy(charToDrop);
        charInfoOpen        = true;
        charRadiusSelect    = false;
        charToEdit          = RaycastLock.hit.transform.gameObject;
        navMeshWanderToEdit = charToEdit.GetComponent <NavMeshWander>();
        charToEdit.GetComponent <NavMeshAgent>().Stop();
        charToEdit.GetComponent <Animator>().enabled = false;
        charInfoPanel.gameObject.SetActive(true);
        selectedMode = navMeshWanderToEdit.mode;

        if (Input.mousePosition.x > Screen.width - charInfoPanel.sizeDelta.x)
        {
            if (Input.mousePosition.y > Screen.height - charInfoPanel.sizeDelta.y)
            {
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, Screen.height - charInfoPanel.sizeDelta.y, 0);
            }
            else if (Input.mousePosition.y < charEditPanel.sizeDelta.y)
            {
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, charEditPanel.sizeDelta.y, 0);
            }
            else
            {
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, Input.mousePosition.y, 0);
            }
        }
        else if (Input.mousePosition.y > Screen.height - charInfoPanel.sizeDelta.y)
        {
            charInfoPanel.transform.position = new Vector3(Input.mousePosition.x, Screen.height - charInfoPanel.sizeDelta.y, 0);
        }
        else if (Input.mousePosition.y < charEditPanel.sizeDelta.y)
        {
            charInfoPanel.transform.position = new Vector3(Input.mousePosition.x, charEditPanel.sizeDelta.y, 0);
        }
        else
        {
            charInfoPanel.transform.position = Input.mousePosition;
        }

        UpdateCharInfoLabels();

        destinationDropDown.ClearOptions();
        destinationDropDown.AddOptions(new List <string>()
        {
            "None"
        });

        destinationDropDown.AddOptions(new List <string>(POIButtonManager.originalHandler.projectPOIs.Select(e => e.buttonName).ToList()));
    }
Пример #3
0
    public void DropCharacter()
    {
        charToDrop.GetComponent <CapsuleCollider>().enabled = true;
        charToDrop.GetComponent <NavMeshAgent>().enabled    = true;
        charToDrop.GetComponent <NavMeshWander>().enabled   = true;
        charToDrop.GetComponent <NavMeshWander>().mode      = (NavMeshWander.WanderMode)newCharWanderSelect.value;

        if ((NavMeshWander.WanderMode)newCharWanderSelect.value == NavMeshWander.WanderMode.Patrol)
        {
            charToEdit          = charToDrop;
            navMeshWanderToEdit = charToEdit.GetComponent <NavMeshWander>();
            StartCharRadiusSelect();
        }
        charToDrop = null;
    }
Пример #4
0
    public void StartCharRadiusSelect()
    {
        if (charToEdit == null && charToDrop != null)
        {
            charToEdit = charToDrop;

            charToDrop = null;
        }
        if (navMeshWanderToEdit == null)
        {
            navMeshWanderToEdit = charToEdit.GetComponent <NavMeshWander>();
        }

        if (charToEdit != null)
        {
            navMeshWanderToEdit.localWanderCenter = charToEdit.transform.position;
        }

        charRadiusSelect = true;
    }
    public void StartCharRadiusSelect()
    {
        if (charToEdit == null && charToDrop != null)
        {
            charToEdit = charToDrop;

            charToDrop = null;
        }
        if(navMeshWanderToEdit == null)
            navMeshWanderToEdit = charToEdit.GetComponent<NavMeshWander>();

        if (charToEdit != null)
            navMeshWanderToEdit.localWanderCenter = charToEdit.transform.position;

        charRadiusSelect = true;
    }
    public void OpenCharacterInfo()
    {
        Destroy(charToDrop);
        charInfoOpen = true;
        charRadiusSelect = false;
        charToEdit = RaycastLock.hit.transform.gameObject;
        navMeshWanderToEdit = charToEdit.GetComponent<NavMeshWander>();
        charToEdit.GetComponent<NavMeshAgent>().Stop();
        charToEdit.GetComponent<Animator>().enabled = false;
        charInfoPanel.gameObject.SetActive(true);
        selectedMode = navMeshWanderToEdit.mode;

        if (Input.mousePosition.x > Screen.width - charInfoPanel.sizeDelta.x)
        {
            if (Input.mousePosition.y > Screen.height - charInfoPanel.sizeDelta.y)
            {
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, Screen.height - charInfoPanel.sizeDelta.y, 0);
            }
            else if (Input.mousePosition.y < charEditPanel.sizeDelta.y)
            {
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, charEditPanel.sizeDelta.y, 0);
            }
            else
                charInfoPanel.transform.position = new Vector3(Screen.width - charInfoPanel.sizeDelta.x, Input.mousePosition.y, 0);
        }
        else if (Input.mousePosition.y > Screen.height - charInfoPanel.sizeDelta.y)
            charInfoPanel.transform.position = new Vector3(Input.mousePosition.x, Screen.height - charInfoPanel.sizeDelta.y, 0);
        else if (Input.mousePosition.y < charEditPanel.sizeDelta.y)
            charInfoPanel.transform.position = new Vector3(Input.mousePosition.x, charEditPanel.sizeDelta.y, 0);
        else
            charInfoPanel.transform.position = Input.mousePosition;

        UpdateCharInfoLabels();

        destinationDropDown.ClearOptions();
        destinationDropDown.AddOptions(new List<string>() { "None" });

        destinationDropDown.AddOptions(new List<string>( POIButtonManager.originalHandler.projectPOIs.Select(e => e.buttonName).ToList()));
    }
    public void DropCharacter()
    {
        charToDrop.GetComponent<CapsuleCollider>().enabled = true;
        charToDrop.GetComponent<NavMeshAgent>().enabled = true;
        charToDrop.GetComponent<NavMeshWander>().enabled = true;
        charToDrop.GetComponent<NavMeshWander>().mode = (NavMeshWander.WanderMode)newCharWanderSelect.value;

        if ((NavMeshWander.WanderMode)newCharWanderSelect.value == NavMeshWander.WanderMode.Patrol)
        {
            charToEdit = charToDrop;
            navMeshWanderToEdit = charToEdit.GetComponent<NavMeshWander>();
            StartCharRadiusSelect();
        }
        charToDrop = null;
    }
    public void CloseCharacterInfo()
    {
        if (hasRaycastLock)
        {
            RaycastLock.GiveLock();
            hasRaycastLock = false;
        }

        CloseCharacterEdit();
        if (charToEdit != null)
            charToEdit.GetComponent<Animator>().enabled = true;
        if (navMeshWanderToEdit != null)
        {
            if(destinationDropDown.value == 0)
                navMeshWanderToEdit.ConfigureDestination();
            else
                navMeshWanderToEdit.ConfigureDestination(destinationDropDown.value - 1);
        }
        ApplyOptions();

        charToEdit = null;
        navMeshWanderToEdit = null;
        charInfoOpen = false;
        charInfoPanel.gameObject.SetActive(false);
    }