예제 #1
0
파일: Nav.cs 프로젝트: 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;
            });
        }
    }
예제 #2
0
파일: Nav.cs 프로젝트: 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");
        }
    }