Exemplo n.º 1
0
Arquivo: Nav.cs Projeto: noegigi/Copy
    IEnumerator MovingCoroutine()
    {
        while (currentNode != targetNode)
        {
            yield return(new WaitForSeconds(speed));

            currentNode = nextNode;
            Vector3 position = currentNode.transform.position;
            position.y += 1;
            nextNode    = currentNode.GetRandomConnectedNode();
            TweenFactory.Tween("moving", transform.position, position, speed, TweenScaleFunctions.Linear, (t) => {
                transform.position = t.CurrentValue;
            });
        }
    }
Exemplo n.º 2
0
Arquivo: Nav.cs Projeto: noegigi/Copy
    private void Start()
    {
        //Get the current node and set the player in position on it
        RaycastHit hitInfo;

        if (Physics.Raycast(transform.position, transform.up * -1, out hitInfo, 1))
        {
            currentNode = hitInfo.transform.GetComponentInChildren <NormalTile>();
            Vector3 position = currentNode.transform.position;
            position.y        += 1;
            transform.position = position;
            nextNode           = currentNode.GetRandomConnectedNode();
            StartCoroutine("MovingCoroutine");
        }
    }