コード例 #1
0
        /// <summary>
        /// Calls the functions from the Wander script and updates the game
        /// </summary>
        void FixedUpdate()
        {
            Vector3 accel = wander.GetSteering();

            steering.Steer(accel);
            steering.LookWhereGoing();
        }
コード例 #2
0
        void FixedUpdate()
        {
            Vector3 accel = flee.GetSteering(fleeFrom.position);

            steering.Steer(accel);
            steering.LookWhereGoing();
        }
コード例 #3
0
        void FixedUpdate()
        {
            // Calls to the Steering script for the arrive function.
            Vector3 accel = steering.Arrive(targetPosition);

            steering.Steer(accel);
            steering.LookWhereGoing();
        }
コード例 #4
0
        void FixedUpdate()
        {
            Vector3 accel = Vector3.zero;

            accel += direction.GetSteering(sensor.targets);
            accel += velocityMatching.GetSteering(sensor.targets) * velocityMatchWeight;

            if (accel.magnitude < 0.05f)
            {
                accel = wander.GetSteering();
            }

            steering.Steer(accel);
            steering.LookWhereGoing();
        }
コード例 #5
0
        void LateUpdate()
        {
            Vector3 targetPos;
            Vector3 offsetAccel     = offsetPursue.GetSteering(target, offsetDistance, out targetPos);
            Vector3 seperationAccel = separation.GetSteering(sensor.targets);

            steering.Steer(offsetAccel + seperationAccel);

            if (Vector3.Distance(transform.position, targetPos) > lookDistance)
            {
                steering.LookWhereGoing();
            }
            else
            {
                steering.LookAtDirection(target.Rotation);
            }
        }