Esempio n. 1
0
    private void SetInitialState()
    {
        bb.shouldMeteorBeTriggedAfterWandering = false;
        bb.meteorInmediate = false;
        angryEyes          = false;
        exitRumble         = false;
        head.NotWatchingPlayer();

        bb.SetWormVulnerable();

        elapsedTime    = 0f;
        WPIndex        = 0;
        destinyInRange = false;
        //Set initial substate, nav mesh layer and select a random route
        subState = SubState.WAITING;

        WormRoute newRoute;

        do
        {
            //int routeNum = Random.Range(0, head.routes.Length);
            int routeNum = Random.Range(bb.WanderingSettingsPhase.routeMinId, bb.WanderingSettingsPhase.routeMaxId + 1);
            newRoute = head.routes[routeNum];
        }while (route == newRoute);

        route = newRoute;
    }
Esempio n. 2
0
    //Debug
    void OnDrawGizmos()
    {
        for (int i = 0; i < routes.Length; ++i)
        {
            WormRoute route = routes[i];

            Gizmos.color = gizmosColors[i % gizmosColors.Length];

            for (int j = 1; j < route.wayPoints.Length; ++j)
            {
                Gizmos.DrawLine(route.wayPoints[j - 1].transform.position, route.wayPoints[j].transform.position);
            }

            Gizmos.color = Color.green;
            Gizmos.DrawSphere(route.wayPoints[0].transform.position, 1f);

            Gizmos.color = Color.red;
            Gizmos.DrawSphere(route.wayPoints[route.wayPoints.Length - 1].transform.position, 1f);
        }
    }