Inheritance: MonoBehaviour
Exemplo n.º 1
0
 void Start()
 {
     if (MB == null)
     {
         MB = transform.gameObject.GetComponent <MeshBoard>();
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        Collider[] cList = Physics.OverlapBox(boy.position, boy.GetComponent <BoxCollider>().bounds.extents, Quaternion.identity, LayerMask.GetMask(LayerName.NavMesh));
        //判断是否在navmesh中
        if (cList != null && cList.Length != 0)
        {
            inNavmesh = true;
            mb        = cList[0].transform.parent.GetComponentInChildren <MeshBoard>();
        }
        else
        {
            inNavmesh = false;
            mb        = null;
        }

        if (inNavmesh)
        {
            //寻路
            a = boy.transform.position + Vector3.up * 0.5f;
            b = cat.transform.position + Vector3.up * 0.3f;
            mb.Init();
            pathList = mb.FindPath(a, b);

            //计算方向:上下左右
            direction = pathList[1] - pathList[0];
        }
    }
Exemplo n.º 3
0
    public void Init( MeshBoard meshboard, int index )
    {
        meshBoard = meshboard;

        Index = index;
        CONTENTCODE = TileContent.Empty;

        SetColor( Color.white );
    }
Exemplo n.º 4
0
    public void Init(MeshBoard meshboard, int index)
    {
        meshBoard = meshboard;

        Index       = index;
        CONTENTCODE = TileContent.Empty;

        SetColor(Color.white);
    }
Exemplo n.º 5
0
    private Tile GenerateTile(int _x, int _y)
    {
        Transform e = MeshBoard.Instantiate(meshBoard.MESH) as Transform;

        e.position = new Vector3(_x - (MeshBoard.WIDTH / 2), -.8f, _y - (MeshBoard.HEIGHT / 2));

        Tile tile = e.GetComponent <Tile>();

        tile.Init(meshBoard, _y + _x * MeshBoard.HEIGHT);

        return(tile);
    }
Exemplo n.º 6
0
    // Vector3 nPos)
    public void Init()
    {
        meshboard = Camera.main.GetComponent<MeshBoard>();

        location  = transform;
        location.position = to3D( new Point( 0,7 ) );

        wayPoint  = to3D( meshboard.GetNextPoint( to2D() ) );

        location.LookAt( wayPoint );
        location.gameObject.active = true;
        location.GetChild(0).gameObject.active = true;

        move = true;
    }
Exemplo n.º 7
0
    public void Init()    // Vector3 nPos)
    {
        meshboard = Camera.main.GetComponent <MeshBoard>();

        location          = transform;
        location.position = to3D(new Point(0, 7));

        wayPoint = to3D(meshboard.GetNextPoint(to2D()));

        location.LookAt(wayPoint);
        location.gameObject.active             = true;
        location.GetChild(0).gameObject.active = true;

        move = true;
    }
Exemplo n.º 8
0
    public GridManager( MeshBoard meshboard, int typ )
    {
        meshBoard = meshboard;

        InitMovements( typ );
    }
Exemplo n.º 9
0
    public GridManager(MeshBoard meshboard, int typ)
    {
        meshBoard = meshboard;

        InitMovements(typ);
    }
Exemplo n.º 10
0
 void Start()
 {
     if( MB == null ) MB = transform.gameObject.GetComponent<MeshBoard>();
 }
Exemplo n.º 11
0
 void OnEnable()
 {
     mb = (MeshBoard)target;
 }
Exemplo n.º 12
0
 public NavPathCalculator(MeshBoard mb)
 {
     this.mb = mb;
 }