Beispiel #1
0
    private void Update()
    {
        //Separation();
        SphereUtils.AlignToSphereSurface(transform, planet);
        SphereUtils.LookAtTarget(transform, planet, target);

        if (unitTask == UnitTask.MoveToTarget)
        {
            MovementLogic();
        }
    }
Beispiel #2
0
    public void Update()
    {
        if (unitGroupTask == UnitGroupTask.MoveToTarget)
        {
            SphereUtils.AlignToSphereSurface(groupOrigin, planet);
            SphereUtils.LookAtTarget(groupOrigin, planet, target);

            AlignWithGroupOrigin();

            var speed = 10f;
            groupOrigin.position = Vector3.RotateTowards(groupOrigin.position, target, (speed / planetRadius) * Time.deltaTime, 1);

            if (Vector3.Distance(groupOrigin.position, target) < 1)
            {
                // Additional logic needed eventually.
                unitGroupTask = UnitGroupTask.Idle;
            }
        }
    }