Esempio n. 1
0
    public override bool PerformAction()
    {
        Vector2 toTarget = target.position - _transform.position;
        float   sqMag    = toTarget.sqrMagnitude;

        //if (sqMag < minDistance * minDistance)
        //movement.applyInfluencePointPosition((Vector2)_transform.position + toTarget, force);
        //else if (sqMag > maxDistance * maxDistance)
        movement.ApplyInfluencePosition(force * toTarget);
        Debug.Log("fsfsdfs");
        return(true);
    }
    public override bool PerformAction()
    {
        Vector2 point = aim.GetLocation();
        Vector2 inf   = (point - new Vector2(movement.transform.position.x, movement.transform.position.z));

        float sqMag = inf.sqrMagnitude;

        inf.Normalize();
        if (sqMag > stopDistance * stopDistance)
        {
            movement.ApplyInfluencePosition(inf * movementSpeed);
        }
        movement.SetRotation(Vector2.Angle(Vector2.up, inf) * (inf.x > 0 ? 1 : -1));

        return(true);
    }
Esempio n. 3
0
    public override bool PerformAction()
    {
        //movement.ApplyInfluencePointRotation(aim.GetLocation(),  rotationSpeed);
        //movement.SetRotationPoint(aim.GetLocation());
        //movement.ApplyInfluencePoint(aim.GetLocation(), movementSpeed, rotationSpeed, stopDistance);

        Vector2 point = aim.GetLocation();
        Vector2 inf   = (point - (Vector2)movement.transform.position);

        float sqMag = inf.sqrMagnitude;

        inf.Normalize();
        if (sqMag > stopDistance * stopDistance)
        {
            movement.ApplyInfluencePosition(inf * movementSpeed);
        }

        movement.ApplyInfluenceRotation(inf * rotationSpeed);

        return(true);
    }
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     movement.ApplyInfluencePosition(directionOfMove);
 }