Пример #1
0
    public void onReloadLevel(Vector3 spawnPos)
    {
        GameObjectTools.setActive(gameObject, true);

        if (bounce.isBouncing())
        {
            bounce.stop();
        }
        patrol.enablePatrol();
        patrol.setDir(1f);         // initialize patrol direction
        patrol.setMoveSpeed(initialPatrolSpeed);
        if (_hide.isHidden())
        {
            _hide.unHide();
        }
        chase.stop();
        chase.setOperable(true);
        if (jump != null)
        {
            jump.setForeverJump(jumpInLoop);
        }

        transform.position = spawnPos;
        shape.body._UpdatedTransform();         // update the body position
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (completed)
        {
            return;                                          // Return early if hidden once
        }
        if (hideBehaviour.getNearbyHidingSpots().Count == 0) // If no hiding spots are within range, move to location
        {
            directionVector = hidingSpotTransform.position - transform.position;
        }
        else if (!hideBehaviour.isHidden()) // If in range, and not hidden, get in closest
        {
            hideBehaviour.hide(hideBehaviour.getClosestHidingSpot());

            if (hideBehaviour.isHidden())
            {
                completed = true;
            }
        }

        base.Update();
    }