Example #1
0
File: Nav.cs Project: 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;
            });
        }
    }
Example #2
0
File: Nav.cs Project: 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");
        }
    }