예제 #1
0
    public void Seek()
    {
        Vector2 desired = (Vector2)TargetPlanet.transform.position - (Vector2)mover.Trans.position;

        desired.Normalize();

        desired *= mover.MaxSpeed;

        Vector2 force = desired - mover.Velocity;

        force = Mover.LimitVector(force, mover.MaxForce);

        mover.AddForce(force);
    }
예제 #2
0
    public void Separate()
    {
        if (count > 0)
        {
            sum /= count;
            //sum.Normalize();
            sum *= MaxSpeed;

            Vector2 force = sum - Mover.Velocity;
            force *= ForceMultiplier;
            force  = Mover.LimitVector(force, Mover.MaxForce);
            Mover.AddForce(force);
            Clear();
        }
    }