Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = steeringBasics.arrive(targetPosition);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = steeringBasics.interpose(target1, target2);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = flee.getSteering(target.position);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 4
0
    void FixedUpdate()
    {
        Vector3 accel = steeringBasics.seek(target.position);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        Vector2 accel = evade.getSteering(target);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 6
0
    void FixedUpdate()
    {
        Vector3 accel = pursue.getSteering(target);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = wander.getSteering();

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        Vector3 target = flowers.SeekFlower();
        Vector3 accel  = steeringBasics.arrive(target);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing(target);
    }
Exemplo n.º 9
0
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.velocity = direction.normalized * steeringBasics.maxVelocity;

        steeringBasics.lookWhereYoureGoing();

        Debug.DrawLine(rb.colliderPosition, rb.colliderPosition + (direction.normalized), Color.cyan, 0f, false);
    }
Exemplo n.º 10
0
 protected void Update()
 {
     if (isMoving)
     {
         Vector3 accel = getDirection(Vector3.zero);
         //Debug.Log(accel);
         steering.steer(accel);  //move
         steering.lookWhereYoureGoing();
     }
 }
Exemplo n.º 11
0
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.velocity = direction.normalized * steeringBasics.maxVelocity;

        steeringBasics.lookWhereYoureGoing();

        Vector3 start = transform.position + (Vector3.up * rb.boundingRadius);

        Debug.DrawLine(start, start + (direction.normalized), Color.cyan, 0f, false);
    }
Exemplo n.º 12
0
    void FixedUpdate()
    {
        if (player != null)
        {
            Vector3 accel = pursue.getSteering(player);

            steeringBasics.steer(accel);
            steeringBasics.lookWhereYoureGoing();
        }
    }
Exemplo n.º 13
0
    private void Arrive(GameObject dest)
    {
        Vector2 accel = new Vector2(0, 0);         // TODO: Tighten this up, we're creating a LOT of new Vector2s here...

        if (destination != null)
        {
            accel = _steeringBasics.arrive(dest.transform.position);
        }

        _steeringBasics.steer(accel);
        _steeringBasics.lookWhereYoureGoing();
    }
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = colAvoid.getSteering(colAvoidSensor.targets);

        if (accel.magnitude < 0.005f)
        {
            accel = wander.getSteering();
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 15
0
    // Update is called once per frame
    void Update()
    {
        path.draw();

        if (reversePath && isAtEndOfPath())
        {
            path.reversePath();
        }

        Vector3 accel = followPath.getSteering(path, pathLoop);

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        Vector2 hidePosition;
        Vector2 hideAccel = hide.getSteering(target, obstacleSpawner.objs, out hidePosition);

        Vector2 accel = wallAvoid.getSteering(hidePosition - (Vector2)transform.position);

        if (accel.magnitude < 0.005f)
        {
            accel = hideAccel;
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 17
0
    void FixedUpdate()
    {
        Vector3 accel = colAvoid.getSteering(colAvoidSensor.targets);

        if (accel.magnitude < 0.005f)
        {
            accel = wander.getSteering();
        }
        else
        {
            Debug.DrawLine(transform.position, transform.position + accel.normalized, Color.red, 0f, false);
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 18
0
    void FixedUpdate()
    {
        Vector3 accel = Vector3.zero;

        accel += cohesion.getSteering(sensor.targets) * cohesionWeight;
        accel += separation.getSteering(sensor.targets) * separationWeight;
        accel += velocityMatch.getSteering(sensor.targets) * velocityMatchWeight;

        if (accel.magnitude < 0.005f)
        {
            accel = wander.getSteering();
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
    // Update is called once per frame
    void LateUpdate()
    {
        Vector2 targetPos;
        Vector2 offsetAccel = offsetPursuit.getSteering(target, offset, out targetPos);
        Vector2 sepAccel    = separation.getSteering(sensor.targets);

        steeringBasics.steer(offsetAccel + sepAccel);

        /* If we are still arriving then look where we are going, else look the same direction as our formation target */
        if (Vector2.Distance(transform.position, targetPos) > groupLookDist)
        {
            steeringBasics.lookWhereYoureGoing();
        }
        else
        {
            steeringBasics.lookAtDirection(target.rotation);
        }
    }
Exemplo n.º 20
0
    void FixedUpdate()
    {
        if (barProgress <= 0 && f.done)
        {
            Map m = GameObject.Find("Map").GetComponent <Map>();
            m.spawn(1);
            Destroy(gameObject);
        }

        if (player == null)
        {
            return;
        }

        float distToPlayer = Vector3.Distance(player.position, transform.position);

        if (!f.done || distToPlayer > awakeDist)
        {
            rb.velocity = Vector3.zero;
            return;
        }

        if (Vector3.Distance(player.position, transform.position) <= explodeDist)
        {
            player.GetComponent <Health>().applyDamage(explodeDmg);
            applyDamage(10000000f);

            Instantiate(explosionPrefab, transform.position, Quaternion.identity);

            rb.velocity = Vector3.zero;

            Camera.main.GetComponent <CameraMovement>().shake = 0.05f;
        }

        Vector3 accel = wallAvoidance.getSteering();

        if (accel.magnitude < 0.005f)
        {
            accel = steeringBasics.arrive(player.position);
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
    // Update is called once per frame
    void Update()
    {
        path.draw();

        if (isAtEndOfPath())
        {
            path.reversePath();
        }

        Vector2 accel = colAvoid.getSteering(colAvoidSensor.targets);

        if (accel.magnitude < 0.005f)
        {
            accel = followPath.getSteering(path);
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();
    }
Exemplo n.º 22
0
    void FixedUpdate()
    {
        if (followPath.isAtEndOfPath(path))
        {
            path.reversePath();
        }

        Vector3 accel = wallAvoidance.getSteering();

        if (accel.magnitude < 0.005f)
        {
            accel = followPath.getSteering(path);
        }

        steeringBasics.steer(accel);
        steeringBasics.lookWhereYoureGoing();

        path.draw();
    }