예제 #1
0
    public void Deactivate(Action callback)
    {
        var cameraData = new MovingUtility.MovingContainer()
        {
            OriginPos = _cameraMovement.To.position,
            TargetPos = _cameraMovement.From.position,
            Duration  = 1f,
        };

        var burgerPosData = new MovingUtility.MovingContainer()
        {
            OriginPos = _burgerMovement.To.position,
            TargetPos = _burgerMovement.From.position,
            Duration  = 1.2f
        };

        var burgerRotData = new MovingUtility.RotationContainer()
        {
            Duration        = 0,
            CurrentRotation = _burgerMovement.From.rotation,
            TargetRotation  = new Vector3(0, 0)
        };

        MovingUtility.MoveTo(cameraData, CameraMove);
        MovingUtility.MoveTo(burgerPosData, BurgerMove);
        MovingUtility.Rotate(burgerRotData, BurgerRotation);

        callback?.Invoke();
    }
예제 #2
0
    public IEnumerator AnimateRequest()
    {
        var burgerRot = new MovingUtility.RotationContainer()
        {
            Duration        = 0.1f,
            CurrentRotation = _burgerOffset.rotation,
            TargetRotation  = new Vector3(-45, 0)
        };

        yield return(MovingUtility.Rotate(burgerRot, RotateBurger));


        var objs = _customerBurger.GetData()._ingridients.Select(obj => (IEditable)obj).ToArray();

        for (int i = 0; i < objs.Length; i++)
        {
            Transform objectTransform = objs[i].GetTransform();

            var position = _burgerOffset.position;

            Vector3 sizedPosition = new Vector3(
                Mathf.Lerp(position.x + -_size.x, position.x + _size.x, ((float)i / (objs.Length - 1))),
                Mathf.Lerp(position.y + -_size.y, position.y + _size.y, ((float)i / (objs.Length - 1))),
                objectTransform.position.z);

            var data = new MovingUtility.MovingContainer()
            {
                Duration  = 0.08f,
                OriginPos = objs[i].GetTransform().position,
                TargetPos = sizedPosition
            };

            var rotData = new MovingUtility.RotationContainer()
            {
                Duration        = data.Duration,
                CurrentRotation = objs[i].GetTransform().rotation,
                TargetRotation  = new Vector3(0, 0, -15)
            };


            MovingUtility.MoveTo(data,
                                 delegate(Vector3 pos) { objs[i].GetTransform().position = pos; });
            yield return(MovingUtility.Rotate(rotData,
                                              delegate(Quaternion quaternion) { objs[i].GetTransform().localRotation = quaternion; }));
        }
    }
예제 #3
0
    private IEnumerator AnimateActivate(Action activatAction)
    {
        var cameraData = new MovingUtility.MovingContainer()
        {
            OriginPos = _cameraMovement.From.position,
            TargetPos = _cameraMovement.To.position,
            Duration  = 1f,
        };

        var burgerPosData = new MovingUtility.MovingContainer()
        {
            OriginPos = _burgerMovement.From.position,
            TargetPos = _burgerMovement.To.position,
            Duration  = 1.2f
        };

        var burgerRotData = new MovingUtility.RotationContainer()
        {
            Duration        = 2,
            CurrentRotation = _burgerMovement.Target.rotation,
            TargetRotation  = new Vector3(0, 180)
        };

        MovingUtility.MoveTo(cameraData, CameraMove);
        MovingUtility.Rotate(burgerRotData, BurgerRotation);

        var rating = BurgerComparer.Compare(_game.CurrentCustomer.Burger.GetData(), _logic.PlayerBurger.GetData());

        if (rating >= 0.5f)
        {
            LevelStatus.Instance.SetSuccessfulCustomers(LevelStatus.Instance.SuccessfulCustomers + 1);
        }

        RatingData data = new RatingData()
        {
            Score       = rating,
            MoneyIncome = (int)(_game.CurrentCustomer.Request.Price * rating)
        };

        Menu.Instance.SwitchPage <RatingPage, RatingData>(data);

        yield return(MovingUtility.MoveTo(burgerPosData, BurgerMove));

        _particles.Play();
        activatAction?.Invoke();
    }