MoveOrder() public method

public MoveOrder ( Vector3 pos, bool toPlayer = false ) : void
pos Vector3
toPlayer bool
return void
Esempio n. 1
0
    void Update()
    {
        /***Left Click****/
        if (Input.GetKey(KeyCode.Mouse0) && _leftClickFlag)
        {
            _leftClickFlag = false;
        }

        if (!Input.GetKey(KeyCode.Mouse0) && !_leftClickFlag)
        {
            _leftClickFlag = true;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out _hit, 100))
            {
                if (_hit.transform.tag == FloorTag)
                {
                    float X = _hit.point.x;
                    float Y = _hit.point.y;
                    float Z = _hit.point.z;

                    //Falcco
                    Vector3 target = new Vector3(X, Actor.transform.position.y, Z);                     //original line
//					Vector3 target = new Vector3(X, Y, Actor.transform.position.z); //Falcco`s line

                    _actorScript.MoveOrder(target);
                }
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        /***Left Click****/
        if (Input.GetKey(KeyCode.Mouse0) && leftClickFlag)
        {
            leftClickFlag = false;
        }

        //Fires ray the where mouse clicked, if the tag of hit object
        //is the same as nodeTag and that object is not visited, move player
        //to that object
        if (!Input.GetKey(KeyCode.Mouse0) && !leftClickFlag)
        {
            leftClickFlag = true;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.transform.tag == nodeTag)
                {
                    Debug.Log("Hit");

                    if (!hit.transform.GetComponent <NodeProperties>().getVisited())
                    {
                        actorScript.MoveOrder(hit.transform.gameObject);
                    }
                }
            }
        }
    }
Esempio n. 3
0
    void Update()
    {
        /***Left Click****/
        if (Input.GetKey(KeyCode.Mouse0) && leftClickFlag)
        {
            leftClickFlag = false;
        }

        if (!Input.GetKey(KeyCode.Mouse0) && !leftClickFlag)
        {
            leftClickFlag = true;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.transform.tag == floorTag)
                {
                    float   X      = hit.point.x;
                    float   Z      = hit.point.z;
                    Vector3 target = new Vector3(X, actor.transform.position.y, Z);

                    actorScript.MoveOrder(target);
                }
            }
        }
    }