示例#1
0
    void Wander()
    {
        if (mov.GetTargetCount() == 0)
        {
            TerrainBoard.SetColor(goalGrid.x, goalGrid.y, Color.white);
            SelectTarget();
            goalGrid = TerrainBoard.transformPositionToGrid(pos + dir);
            if (!TerrainBoard.map.InBound(goalGrid))
            {
                return;
            }

            TerrainBoard.SetColor(goalGrid.x, goalGrid.y, Color.red);
            mov.ResetTarget(Search(pos, pos + dir));
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (InitializationError)
        {
            return;
        }

        AIMovement mov = GetComponent <AIMovement>();

        if (Input.GetMouseButtonDown(1))
        {
            var v3 = Input.mousePosition;
            v3.z = 0;
            v3   = Camera.main.ScreenToWorldPoint(v3);

            mov.ResetTarget(Search(transform.position, v3));
        }
    }