Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Triggerbot()
        {
            // Initialize Fovs.
            Fovs = new List <Fov>
            {
                new Fov {
                    Resolution = new Point(1920, 1080), FieldOfView = new Rectangle(960, 400, 1, 165)
                }
            };

            MyFov = Fovs.FirstOrDefault(x => x.Resolution == new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));

            // Run the aimbot.
            var thread = new Thread(Run);

            if (MyFov != null)
            {
                thread.Start();
                LogInfo("Triggerbot initialized");
            }
            else
            {
                LogError("Could not initialize Triggerbot as screen does not match available resolutions.\n" +
                         "This will be fixed later, for now make your screen resolution 1920x1080.\n");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Widowbot()
        {
            // Initialize Fovs.
            Fovs = new List <Fov>
            {
                new Fov {
                    Resolution = new Point(1920, 1080), FieldOfView = new Rectangle(880, 510, 160, 50), RangeValues = new Point(0, 28), Tolerance = new Point(2, 2)
                },
                new Fov {
                    Resolution = new Point(1280, 720), FieldOfView = new Rectangle(580, 335, 120, 40), RangeValues = new Point(0, 18), Tolerance = new Point(2, 2)
                }
            };

            MyFov = Fovs.FirstOrDefault(x => x.Resolution == new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));

            if (MyFov != null)
            {
                // Run the aimbot.
                new Thread(Run).Start();
                LogInfo("Widowbot initialized");
            }
            else
            {
                LogError("Could not initialize Widowbot as screen does not match resolution.\n" +
                         "This will be fixed later, for now make your screen resolution 1920x1080\nor 1280x720.\n");
            }
        }
Ejemplo n.º 3
0
        public override Pose Output()
        {
            Fov.Calculate();
            Lock.Calculate();
            CP.Calculate();

            Pose pose = Pose.Default;

            if (modifier != null)
            {
                pose = modifier.Prev.value;
            }

            if (!Fov.value.isNull)
            {
                pose.fov = Fov.value.value_f;
            }

            if (!Lock.value.isNull)
            {
                pose.lockCursor = Lock.value.value_b;
            }

            if (!CP.value.isNull)
            {
                pose.cursorPos = new Vector2(CP.value.value_v.x, CP.value.value_v.y);
            }

            return(pose);
        }
Ejemplo n.º 4
0
        private void RecreateWidowbotFov(bool updateDrawing)
        {
            var width  = (int)nudWidowFovWidth.Value;
            var height = (int)nudWidowFovHeight.Value;

            var view = new Rectangle(resolution.X / 2 - width / 2,
                                     resolution.Y / 2 - height / 2,
                                     width,
                                     height);

            var offset = new Point((int)nudWidowXOffset.Value, (int)nudWidowYOffset.Value);

            var tolerance = new Point((int)nudWidowXTolerance.Value, (int)nudWidowYTolerance.Value);

            var fov = new Fov {
                FieldOfView = view, Offset = offset, Tolerance = tolerance
            };

            widowbot.AssignFov(fov);

            SettingsManager.Widowbot.FieldOfView = fov;

            if (updateDrawing && drawingForm != null)
            {
                drawingForm.widowRect = view;
                UpdateDrawingFrame();
            }
        }
Ejemplo n.º 5
0
        private void Update(EvaluationContext context)
        {
            Reference.DirtyFlag.Clear();
            LastObjectToWorld = context.ObjectToWorld;

            var fov         = MathUtil.DegreesToRadians(Fov.GetValue(context));
            var aspectRatio = AspectRatio.GetValue(context);

            if (aspectRatio < 0.0001f)
            {
                aspectRatio = (float)context.RequestedResolution.Width / context.RequestedResolution.Height;
            }
            System.Numerics.Vector2 clip = NearFarClip.GetValue(context);
            CameraToClipSpace = Matrix.PerspectiveFovRH(fov, aspectRatio, clip.X, clip.Y);

            var positionValue     = Position.GetValue(context);
            var eye               = new Vector3(positionValue.X, positionValue.Y, positionValue.Z);
            var targetValue       = Target.GetValue(context);
            var target            = new Vector3(targetValue.X, targetValue.Y, targetValue.Z);
            var upValue           = Up.GetValue(context);
            var up                = new Vector3(upValue.X, upValue.Y, upValue.Z);
            var worldToCameraRoot = Matrix.LookAtRH(eye, target, up);

            var rollRotation = Matrix.RotationAxis(new Vector3(0, 0, 1), -(float)Roll.GetValue(context));

            var pOffset = PositionOffset.GetValue(context);
            var additionalTranslation = Matrix.Translation(pOffset.X, pOffset.Y, pOffset.Z);

            var rOffset            = RotationOffset.GetValue(context);
            var additionalRotation = Matrix.RotationYawPitchRoll(MathUtil.DegreesToRadians(rOffset.Y),
                                                                 MathUtil.DegreesToRadians(rOffset.X),
                                                                 MathUtil.DegreesToRadians(rOffset.Z));

            WorldToCamera = worldToCameraRoot * rollRotation * additionalTranslation * additionalRotation;


            if (context.BypassCameras)
            {
                Command.GetValue(context);
                Log.Debug($"Bypassing {SymbolChildId}", SymbolChildId);
                return;
            }

            // Set properties and evaluate sub tree
            var prevWorldToCamera     = context.WorldToCamera;
            var prevCameraToClipSpace = context.CameraToClipSpace;

            context.WorldToCamera     = WorldToCamera;
            context.CameraToClipSpace = CameraToClipSpace;

            Command.GetValue(context);

            context.CameraToClipSpace = prevCameraToClipSpace;
            context.WorldToCamera     = prevWorldToCamera;
        }
Ejemplo n.º 6
0
        void UpdateViewAndMaterialParameters(HmdParameters hmd, DisplayParameters display)
        {
            Distortion distortion = new Distortion(hmd.DistortionK1, hmd.DistortionK2);

            distortion.DistortionK1 = hmd.DistortionK1;
            distortion.DistortionK2 = hmd.DistortionK2;

            float zNear = _camWorldLeft.nearClipPlane;
            float zFar  = _camWorldLeft.farClipPlane;

            Fov displayDistancesLeft = Calculator.GetFovDistancesLeft(display, hmd);

            // То, как должен видеть левый глаз свой кусок экрана. Без линзы. C учётом только размеров дисплея
            Fov fovDisplayTanAngles = displayDistancesLeft / hmd.ScreenToLensDist;

            // FoV шлема
            Fov hmdMaxFovTanAngles = Fov.AnglesToTanAngles(hmd.MaxFovAngles);

            // То, как должен видеть левый глаз свой кусок экрана. Без линзы. C учётом размеров дисплея и FoV шлема
            Fov fovEyeTanAglesLeft = Fov.Min(fovDisplayTanAngles, hmdMaxFovTanAngles);

            // То, как должен видеть левый глаз. Мнимое изображение (после увеличения идеальной линзой без искажений). С широким углом. Именно так надо снять сцену
            Fov fovWorldTanAnglesLeft = Calculator.DistortTanAngles(fovEyeTanAglesLeft, distortion);

            Matrix4x4 projWorldLeft;
            Matrix4x4 projWorldRight;

            Calculator.ComposeProjectionMatricesFromFovTanAngles(fovWorldTanAnglesLeft, zNear, zFar, out projWorldLeft, out projWorldRight);

            Matrix4x4 projEyeLeft;
            Matrix4x4 projEyeRight;

            Calculator.ComposeProjectionMatricesFromFovTanAngles(fovDisplayTanAngles, zNear, zFar, out projEyeLeft, out projEyeRight);

            _camWorldLeft.transform.localPosition  = 0.5f * Vector3.left * hmd.InterlensDistance;
            _camWorldRight.transform.localPosition = 0.5f * Vector3.right * hmd.InterlensDistance;

            _camEyeLeft.transform.localPosition  = 0.5f * Vector3.left * hmd.InterlensDistance;
            _camEyeRight.transform.localPosition = 0.5f * Vector3.right * hmd.InterlensDistance;

            _camWorldLeft.projectionMatrix  = projWorldLeft;
            _camWorldRight.projectionMatrix = projWorldRight;

            _camWorldLeftScaler.SetFov(fovWorldTanAnglesLeft);
            _camWorldRightScaler.SetFov(fovWorldTanAnglesLeft.GetFlippedHorizontally());

            _camEyeLeft.projectionMatrix  = projEyeLeft;
            _camEyeRight.projectionMatrix = projEyeRight;

            EyeMaterialLeft.SetFloat("_DistortionK1", hmd.DistortionK1);
            EyeMaterialRight.SetFloat("_DistortionK1", hmd.DistortionK1);

            EyeMaterialLeft.SetFloat("_DistortionK2", hmd.DistortionK2);
            EyeMaterialRight.SetFloat("_DistortionK2", hmd.DistortionK2);
        }
Ejemplo n.º 7
0
    private void Init()
    {
        AreaReady     = false;
        AreaMapHolder = new GameObject("AreaMapHolder");

        if (FovHolder == null)
        {
            FovHolder = GameObject.Find("Fov");
        }

        Fov = FovHolder.GetComponent <Fov>();

        if (_player == null || _player != GameManager.Instance.Player)
        {
            _player = GameManager.Instance.Player;
            InstantiatePlayerSprite();
        }

        _areaMapHolderTransform = AreaMapHolder.transform;

        _currentArea           = GameManager.Instance.CurrentArea;
        _currentArea.TurnOrder = new Queue <Entity>();
        _currentArea.TurnOrder.Enqueue(_player);
        _currentArea.Build();

//        if (_currentArea.ParentCell.Rivers.Count > 0)
//        {
//            PlaceWaterTiles();
//        }

        DrawArea();
        PlaceBuildings();
        PlacePlayer();

        if (_currentArea.PresentEntities.Count > 1)
        {
            PlaceNpcs();
            MarkCustomers();
        }

        CreateAStarGraph();
        AstarPath.active.Scan();

        Fov.Init(_currentArea);
        var v = new Vinteger(_player.CurrentTile.X, _player.CurrentTile.Y);

        Fov.Refresh(v);

        Messenger.Instance.LoadOnScreenMessages();

        AreaReady = true;
    }
Ejemplo n.º 8
0
    void OnSceneGUI()
    {
        Fov fov = (Fov)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fov.transform.position, Vector3.up, Vector3.forward, 360, fov.radius);
        Vector3 anglea = fov.direction(-fov.angle / 2, false);                                  //left edge
        Vector3 angleb = fov.direction(fov.angle / 2, false);                                   //right edge

        Handles.DrawLine(fov.transform.position, fov.transform.position + anglea * fov.radius); //draw left
        Handles.DrawLine(fov.transform.position, fov.transform.position + angleb * fov.radius); //draw right
        if (fov.target != null)
        {
            Handles.DrawLine(fov.transform.transform.position, fov.target.position);
        }
    }
Ejemplo n.º 9
0
        private void Update(EvaluationContext context)
        {
            float fov         = MathUtil.DegreesToRadians(Fov.GetValue(context));
            float aspectRatio = AspectRatio.GetValue(context);

            if (aspectRatio < 0.0001f)
            {
                aspectRatio = (float)context.RequestedResolution.Width / context.RequestedResolution.Height;
            }
            System.Numerics.Vector2 clip = NearFarClip.GetValue(context);
            Matrix cameraToClipSpace     = Matrix.PerspectiveFovRH(fov, aspectRatio, clip.X, clip.Y);

            var     positionValue = Position.GetValue(context);
            Vector3 eye           = new Vector3(positionValue.X, positionValue.Y, positionValue.Z);
            var     targetValue   = Target.GetValue(context);
            Vector3 target        = new Vector3(targetValue.X, targetValue.Y, targetValue.Z);
            var     upValue       = Up.GetValue(context);
            Vector3 up            = new Vector3(upValue.X, upValue.Y, upValue.Z);
            Matrix  worldToCamera = Matrix.LookAtRH(eye, target, up);

            //var worldToCamera = Matrix.LookAtLH(position, target, new Vector3(0, 1, 0));
            var rollRotation = Matrix.RotationAxis(new Vector3(0, 0, 1), -(float)Roll.GetValue(context));

            var pOffset = PositionOffset.GetValue(context);
            var additionalTranslation = Matrix.Translation(pOffset.X, pOffset.Y, pOffset.Z);

            var rOffset            = RotationOffset.GetValue(context);
            var additionalRotation = Matrix.RotationYawPitchRoll(MathUtil.DegreesToRadians(rOffset.Y),
                                                                 MathUtil.DegreesToRadians(rOffset.X),
                                                                 MathUtil.DegreesToRadians(rOffset.Z));


            var worldToCamera2 = worldToCamera * rollRotation * additionalTranslation * additionalRotation;

            var prevWorldToCamera     = context.WorldToCamera;
            var prevCameraToClipSpace = context.CameraToClipSpace;

            context.WorldToCamera     = worldToCamera2;
            context.CameraToClipSpace = cameraToClipSpace;

            Command.GetValue(context);

            context.CameraToClipSpace = prevCameraToClipSpace;
            context.WorldToCamera     = prevWorldToCamera;
        }
Ejemplo n.º 10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>	Move creature to a new location. </summary>
        ///
        /// <remarks>	Darrellp, 10/15/2011. </remarks>
        ///
        /// <param name="creature">					The creature. </param>
        /// <param name="newLocation">				The new location. </param>
        /// <param name="firstTimeHeroPlacement">	true when placing the hero the first time. </param>
        /// <param name="run">						true when this is part of a run. </param>
        /// <param name="litAtStartOfRun">			A list of lit locations at the start of a run. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public void MoveCreatureTo(
            Creature creature,
            MapCoordinates newLocation,
            bool firstTimeHeroPlacement = false,
            bool run = false,
            List <MapCoordinates> litAtStartOfRun = null)
        {
            // Get the data from the current location
            var data        = this[creature.Location];
            var oldPosition = creature.Location;

            // Remove the creature from this location
            data.RemoveItem(creature);

            // Place the creature at the new location
            creature.Location = newLocation;
            this[creature.Location].AddItem(creature);

            // If it's the player and there's a FOV to be calculated
            if (creature.IsPlayer && !run && Fov != null)
            {
                // Rescan for FOV
                Fov.Scan(HeroPosition);
                Relight();
            }

            // If we've got a game object
            // Invoke the move event through it
            Game?.InvokeEvent(EventType.CreatureMove, this,
                              new CreatureMoveEventArgs(
                                  this,
                                  creature,
                                  oldPosition,
                                  newLocation,
                                  firstTimeHeroPlacement,
                                  isBlocked: false,
                                  isRunning: run,
                                  litAtStartOfRun: litAtStartOfRun));
        }
Ejemplo n.º 11
0
        public override Pose Output()
        {
            Fov.Calculate();
            Near.Calculate();

            Pose pose = Pose.Default;

            if (modifier != null)
            {
                pose = modifier.Prev.value;
            }

            if (!Fov.value.isNull)
            {
                pose.fov = Fov.value.value_f;
            }

            if (!Near.value.isNull)
            {
                pose.nearClip = Near.value.value_f;
            }

            return(pose);
        }
Ejemplo n.º 12
0
        private void RecreateTriggerbotFov(bool updateDrawing)
        {
            var width  = (int)nudTriggerFovWidth.Value;
            var height = (int)nudTriggerFovHeight.Value;

            var view = new Rectangle(resolution.X / 2 - width / 2,
                                     resolution.Y / 2 - height / 2,
                                     width,
                                     height);

            var fov = new Fov {
                FieldOfView = view
            };

            triggerbot.AssignFov(fov);

            SettingsManager.Triggerbot.FieldOfView = fov;

            if (updateDrawing && drawingForm != null)
            {
                drawingForm.triggerRect = view;
                UpdateDrawingFrame();
            }
        }
Ejemplo n.º 13
0
        private void Update(EvaluationContext context)
        {
            float fov         = MathUtil.DegreesToRadians(Fov.GetValue(context));
            float aspectRatio = AspectRatio.GetValue(context);

            if (aspectRatio < 0.0001f)
            {
                aspectRatio = (float)context.RequestedResolution.Width / context.RequestedResolution.Height;
            }
            System.Numerics.Vector2 clip = NearFarClip.GetValue(context);

            Matrix cameraToClipSpace = Matrix.PerspectiveFovRH(fov, aspectRatio, clip.X, clip.Y);

            // var pos = Position.GetValue(context);
            // Vector3 eye = new Vector3(pos.X, pos.Y, pos.Z);

            Vector3 p                = new Vector3(0, 0, Radius.GetValue(context));
            var     seed             = Seed.GetValue(context);
            var     wobbleSpeed      = WobbleSpeed.GetValue(context);
            var     wobbleComplexity = (int)MathUtils.Clamp(WobbleComplexity.GetValue(context), 1, 8);

            //var offset =
            var rotOffset = RotationOffset.GetValue(context);

            // Orbit rotation
            System.Numerics.Vector3 t = Center.GetValue(context);
            Vector3 target            = new Vector3(t.X, t.Y, t.Z);

            var rot = Matrix.RotationYawPitchRoll(
                ComputeAngle(SpinAngleAndWobble, 1)
                + MathUtil.DegreesToRadians((float)(SpinRate.GetValue(context)
                                                    * (EvaluationContext.BeatTime + SpinOffset.GetValue(context)) * 360
                                                    + MathUtils.PerlinNoise(0, 1, 6, seed) * 360))
                ,
                -ComputeAngle(OrbitAngleAndWobble, 2),
                0);
            var p2  = Vector3.Transform(p, rot);
            var eye = new Vector3(p2.X, p2.Y, p2.Z);

            // View rotation
            var viewDirection = target - eye;

            var rotateAim = Matrix.RotationYawPitchRoll(
                ComputeAngle(AimYawAngleAndWobble, 3) + rotOffset.X * MathUtils.ToRad,
                ComputeAngle(AimPitchAngleAndWobble, 4) + rotOffset.Y * MathUtils.ToRad,
                rotOffset.Z * MathUtils.ToRad);


            var adjustedViewDirection = Vector3.TransformNormal(viewDirection, rotateAim);

            target = eye + adjustedViewDirection;


            // Computing matrix
            var     u  = Up.GetValue(context);
            Vector3 up = new Vector3(u.X, u.Y, u.Z);

            var roll = ComputeAngle(AimRollAngleAndWobble, 5);
            var rotateAroundViewDirection = Matrix.RotationAxis(adjustedViewDirection, roll);

            up = Vector3.TransformNormal(up, rotateAroundViewDirection);

            Matrix worldToCamera = Matrix.LookAtRH(eye, target, up);

            var prevCameraToClipSpace = context.CameraToClipSpace;

            context.CameraToClipSpace = cameraToClipSpace;

            var prevWorldToCamera = context.WorldToCamera;

            context.WorldToCamera = worldToCamera;
            Command.GetValue(context);

            context.CameraToClipSpace = prevCameraToClipSpace;
            context.WorldToCamera     = prevWorldToCamera;


            float ComputeAngle(Slot <Vector2> angleAndWobbleInput, int seedIndex)
            {
                var angleAndWobble = angleAndWobbleInput.GetValue(context);
                var wobble         = Math.Abs(angleAndWobble.Y) < 0.001f
                                 ? 0
                                 : (MathUtils.PerlinNoise((float)EvaluationContext.BeatTime * wobbleSpeed,
                                                          1, wobbleComplexity, seed - 123 * seedIndex) - 0.5f) * 2 * angleAndWobble.Y;

                return(MathUtil.DegreesToRadians(angleAndWobble.X + wobble));
            }
        }
Ejemplo n.º 14
0
 public virtual void UpdateFov()
 {
     Fov.ComputeFov(Location.X, Location.Y, 5, true);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Moves the mouse.
        /// </summary>
        /// <param name="myFov"></param>
        /// <param name="coordinates"></param>
        public static void Move(ref Fov myFov, Point coordinates, bool forceHeadshot = false)
        {
            // Get the crosshair position.
            var crosshair = new Point
            {
                X = myFov.Resolution.X / 2,
                Y = myFov.Resolution.Y / 2
            };

            // Determine the stepcounts.
            var stepCount = new Point();
            var step      = new Point();

            // Calculate the destination.
            var destination = new Point
            {
                X = coordinates.X + myFov.RangeValues.X,
                Y = coordinates.Y + myFov.RangeValues.Y
            };

            // Calculate the difference from the crosshair.
            var difference = new Point
            {
                X = Math.Abs(crosshair.X - destination.X),
                Y = Math.Abs(crosshair.Y - destination.Y)
            };

            stepCount.X = 5;
            stepCount.Y = 3;

            // X-axis.
            if (difference.X < 10)
            {
                stepCount.X = 1;

                if (SettingsManager.Aimbot.AntiShake)
                {
                    Thread.Sleep(1);
                }
            }
            else if (difference.X < 40)
            {
                stepCount.X = 5;
                Thread.Sleep(1);
            }

            step.X = stepCount.X;

            if (crosshair.X > destination.X)
            {
                step.X = -stepCount.X;
            }

            // Y-axis.
            if (difference.Y < 10)
            {
                stepCount.Y = 1;
            }

            step.Y = stepCount.Y;

            if (crosshair.Y > destination.Y)
            {
                step.Y = -stepCount.Y;
            }

            if (crosshair.X > destination.X + myFov.Tolerance.X || crosshair.X < destination.X - myFov.Tolerance.X)
            {
                ExecuteMove(step.X, 0);

                if (forceHeadshot)
                {
                    if (crosshair.Y > destination.Y + myFov.Tolerance.Y || crosshair.Y < destination.Y - myFov.Tolerance.Y)
                    {
                        ExecuteMove(0, step.Y);
                    }
                }
            }
        }
Ejemplo n.º 16
0
    public virtual void Start()
    {
        transitions = new Dictionary <Focusswitch, estate>
        {
            { new Focusswitch(estate.wander, eaction.spot), estate.chase },
            { new Focusswitch(estate.wander, eaction.lose), estate.wander },
            { new Focusswitch(estate.wander, eaction.inrange), estate.attack },
            { new Focusswitch(estate.wander, eaction.earshot), estate.chase },

            { new Focusswitch(estate.chase, eaction.inrange), estate.attack },
            { new Focusswitch(estate.chase, eaction.lose), estate.wander },
            { new Focusswitch(estate.chase, eaction.spot), estate.chase },
            { new Focusswitch(estate.chase, eaction.earshot), estate.chase },

            { new Focusswitch(estate.attack, eaction.spot), estate.chase },
            { new Focusswitch(estate.attack, eaction.inrange), estate.attack },
            { new Focusswitch(estate.attack, eaction.lose), estate.wander },
            { new Focusswitch(estate.attack, eaction.earshot), estate.attack },
        };
        funcs = new Dictionary <estate, Action>
        {
            { estate.attack, new Action(attack) },
            { estate.chase, new Action(chase) },
            { estate.wander, new Action(wander) },
        };

        Transform playerwrap = GameObject.FindGameObjectWithTag("Player").transform;

        player                   = playerwrap.GetComponent <Thief> ();
        target                   = playerwrap.transform.FindChild("fpcontrol");
        fov                      = transform.GetComponent <Fov> ();
        fov.speed                = speed * 2;
        fov.enabled              = false;
        nmagent                  = GetComponent <NavMeshAgent> ();
        nmagent.speed            = speed;
        nmagent.stoppingDistance = stoprange;
        anim                     = transform.GetChild(0).GetComponent <Animator> ();
        gun                      = transform.FindChild("gun");
        gunpoint                 = gun.FindChild("point");
        //gunhold = transform.FindChild ("ghold");
        gun.parent        = gunhold;
        gun.localPosition = Vector3.zero;
        gun.localRotation = Quaternion.identity;
        gun.gameObject.SetActive(false);
        playerlayer = LayerMask.NameToLayer("player");
        //Transform activwrap = GameObject.Find ("activities").transform;
        stage = transform.parent.parent;
        Transform activwrap = stage.FindChild("activities");

        if (activwrap)
        {
            activities = new List <Activity> ();
            for (int i = 0; i < activwrap.childCount; i++)
            {
                activities.Add(activwrap.GetChild(i).GetComponent <Activity> ());
            }
            rng          = transform.GetComponent <Rng> ();
            rng.activlen = activities.Count;
            //pickactivity ();
        }

        /*rng = transform.GetComponent<Rng> ();
         * rng.activlen = activities.Count;*/
        viewbox    = transform.FindChild("viewbox").gameObject;
        viewboxlit = transform.FindChild("viewboxlit").gameObject;

        if (patrol)
        {
            //Transform routewrap = transform.FindChild ("patrol");
            routepoint = 0;
            route      = new List <Transform> ();
            //print ("rlen - "+routewrap.childCount);
            for (int i = 0; i < routewrap.childCount; i++)
            {
                route.Add(routewrap.GetChild(i));
            }
        }

        pickactivity();
        StartCoroutine("hunt", .1f);
    }