Ejemplo n.º 1
0
        public void Start()
        {
            if (_button == null)
            {
                throw new Exception("MainSceneController::Start - Missing button");
            }
            if (_input == null)
            {
                throw new Exception("MainSceneController::Start - Missing input");
            }

            _button.interactable = false;
            _button.onClick.AddListener(CmdProceed);

            // _input.text = string.Join(", ", appService.GetEntries());

            _random = new System.Random((int)Time.time);

            ResetColorList();

            _input.onSubmit.AddListener(OnSearchFieldSubmitted);
            _button.interactable = true;

            // tween setup for button
            var rtf = _button.GetComponent <RectTransform>();

            buttonTween = new FloatTween();
            buttonTween.Start(-40, -200, 0.6f, ScaleFuncs.SineEaseInOut);
        }
Ejemplo n.º 2
0
        public static void DrawEquipmentAiming_Prefix(PawnRenderer __instance, Thing eq, Vector3 drawLoc,
                                                      ref float aimAngle)
        {
            Pawn pawn = __instance.graphics.pawn;

            // Flip the angle for north

            if (pawn.Rotation == Rot4.North && aimAngle == angleStanding)
            {
                aimAngle = angleStandingFlipped;
            }

            if (!pawn.GetCompAnim(out CompBodyAnimator animator))
            {
                return;
            }

            if (Find.TickManager.TicksGame == animator.LastAngleTick)
            {
                aimAngle = animator.LastAimAngle;
                return;
            }
            animator.LastAngleTick = Find.TickManager.TicksGame;

            float angleChange;

            float startAngle = animator.LastAimAngle;
            float endAngle   = aimAngle;

            FloatTween tween = animator.AimAngleTween;

            switch (tween.State)
            {
            case TweenState.Running:
                startAngle = tween.EndValue;
                endAngle   = aimAngle;
                aimAngle   = tween.CurrentValue;
                break;
            }

            angleChange = CalcShortestRot(startAngle, endAngle);
            if (Mathf.Abs(angleChange) > 6f)
            {
                // no tween for flipping
                bool x = Mathf.Abs(animator.LastAimAngle - angleStanding) < 3f &&
                         Mathf.Abs(aimAngle - angleStandingFlipped) < 3f;
                bool y = Mathf.Abs(animator.LastAimAngle - angleStandingFlipped) < 3f &&
                         Mathf.Abs(aimAngle - angleStanding) < 3f;
                bool z = Math.Abs(Mathf.Abs(aimAngle - animator.LastAimAngle) - 180f) < 12f;

                if (!x && !y && !z)
                {
                    //     if (Math.Abs(aimAngleTween.EndValue - weaponAngle) > 6f)

                    tween.Start(startAngle, startAngle + angleChange, Mathf.Abs(angleChange), ScaleFuncs.QuinticEaseOut);
                    aimAngle = startAngle;
                }
            }
            animator.LastAimAngle = aimAngle;
        }
Ejemplo n.º 3
0
        public void Update()
        {
            buttonTween.Update(Time.deltaTime);

            var rtf = _button.GetComponent <RectTransform>();

            rtf.sizeDelta = new Vector2(buttonTween.CurrentValue, rtf.sizeDelta.y);

            if (buttonTween.State == TweenState.Stopped)
            {
                buttonTween.Start(buttonTween.EndValue, buttonTween.StartValue, 0.6f, ScaleFuncs.SineEaseInOut);
            }
        }