Ejemplo n.º 1
0
        public override void execute()
        {
            if (!beginGoalShow)
            {
                return;
            }

            if (waitTime.HasValue)
            {
                if (timer < waitTime.Value)
                {
                    timer += Time.deltaTime;
                    return;
                }
                waitTime = null;
                timer    = 0;
            }

            if (timer < cameraCtrl.config.goalMoveTime)
            {
                var position = Vector3.Slerp(cameraCtrl.config.goalBeginPosition, cameraCtrl.config.goalEndPosition, timer / cameraCtrl.config.goalMoveTime);
                cameraCtrl.transform.position = calculateOffsetPosition(actor, position);
                cameraCtrl.transform.forward  = (actor.getCenterPosition() - cameraCtrl.transform.position).normalized;
                timer += Time.deltaTime;
            }
            else
            {
                beginGoalShow = false;
            }
        }
Ejemplo n.º 2
0
 protected Vector3 getActorViewport(ActorView actor)
 {
     if (actor == null)
     {
         Debug.LogError("actor is null");
         return(Vector3.zero);
     }
     return(cameraCtrl.cam.WorldToViewportPoint(actor.getCenterPosition()));
 }
Ejemplo n.º 3
0
        void playSelfDefiance(ActorView self)
        {
            var targetPosition = calculateOffsetPosition(self, cameraCtrl.config.showActorOffset);

            lookAtTime = cameraCtrl.config.showSelfMoveTime;
            cameraCtrl.transform.DOMove(targetPosition, cameraCtrl.config.showSelfMoveTime)
            .SetDelay(cameraCtrl.config.aroundStayTime)
            .OnStart(() =>
            {
                curLookAtPosition = self.getCenterPosition();
                lookAtTweener     = cameraCtrl.transform.DOLookAt(curLookAtPosition, lookAtTime);
            })
            .OnComplete(() =>
            {
                lookAtTweener.Kill();
                lookAtTweener = null;
                LogicEvent.fire("onPlayTaunt", self.id);
            });
        }
Ejemplo n.º 4
0
        void around(ActorView enemy, ActorView self)
        {
            var enemyPosition = enemy.getCenterPosition();
            var selfPosition  = self.getCenterPosition();

            curLookAtPosition = Vector3.Lerp(enemyPosition, selfPosition, cameraCtrl.config.aroundRatio);
            var matrix         = Matrix4x4.TRS(curLookAtPosition, Quaternion.LookRotation((selfPosition - enemyPosition).normalized), Vector3.one);
            var targetPosition = matrix.MultiplyPoint(cameraCtrl.config.aroundOffset);

            lookAtTime = cameraCtrl.config.aroundMoveTime;
            cameraCtrl.transform.DOMove(targetPosition, lookAtTime)
            .SetDelay(cameraCtrl.config.enemyTauntTime)
            .OnStart(() =>
            {
                lookAtTweener = cameraCtrl.transform.DOLookAt(curLookAtPosition, lookAtTime);
            })
            .OnComplete(() =>
            {
                lookAtTweener.Kill();
                lookAtTweener = null;
                playSelfDefiance(self);
            });
        }