Exemplo n.º 1
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()));
    }
Exemplo n.º 2
0
    public void CloseCharacterEdit()
    {
        if (navMeshWanderToEdit != null && charEditOpen)
        {
            if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Idle")
            {
                selectedMode = (NavMeshWander.WanderMode) 0;
            }
            else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Explore")
            {
                selectedMode = (NavMeshWander.WanderMode) 2;
            }
            else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Patrol")
            {
                selectedMode = (NavMeshWander.WanderMode) 1;
                navMeshWanderToEdit.localWanderCenter = charToEdit.transform.position;
                navMeshWanderToEdit.localWanderRadius = float.Parse(radiusInput.text);
            }
        }

        charEditOpen = false;
        charEditPanel.gameObject.SetActive(false);
    }
    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 CloseCharacterEdit()
    {
        if (navMeshWanderToEdit != null && charEditOpen)
        {
            if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Idle")
                selectedMode = (NavMeshWander.WanderMode)0;
            else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Explore")
                selectedMode = (NavMeshWander.WanderMode)2;
            else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Patrol")
            {
                selectedMode = (NavMeshWander.WanderMode)1;
                navMeshWanderToEdit.localWanderCenter = charToEdit.transform.position;
                navMeshWanderToEdit.localWanderRadius = float.Parse(radiusInput.text);

            }
        }

        charEditOpen = false;
        charEditPanel.gameObject.SetActive(false);
    }