Пример #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     animator = GetComponent <Animator>();
 }
Пример #2
0
 public override void Select()
 {
     Toolbox.Instance.gameState.MoneyCounter += SellPrice;
     if (All.Count(s => s is Sellable) == 1)
     {
         EndAnimation.Play();
     }
     Destroy(gameObject);
 }
Пример #3
0
        private void AnimationCommandExtension_BindingContextChanged(object sender, EventArgs e)
        {
            var bo = (BindableObject)sender;

            try
            {
                //Command wrap
                var command = new Command(async() =>
                {
                    var control         = (View)((GestureRecognizer)sender).Parent;
                    var animationToPlay = StartAnimation ?? new DefaultAnimation();
                    try
                    {
                        if (control != null)
                        {
                            await animationToPlay.Play(control);
                        }
                    }
                    catch
                    {
                        Debug.WriteLine($"{nameof(AnimationCommandExtension)}.StartAnimation Exception");
                    }

                    try
                    {
                        var baseCommand = (ICommand)MarkupExtensionHelper.ExtractMember(bo, (Binding)Binding);
                        if (baseCommand != null && baseCommand.CanExecute(_parameter))
                        {
                            baseCommand.Execute(_parameter);
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine(exception.Message);
                    }

                    try
                    {
                        if (EndAnimation != null && control != null)
                        {
                            await EndAnimation.Play(control);
                        }
                    }
                    catch
                    {
                        Debug.WriteLine($"{nameof(AnimationCommandExtension)}.EndAnimation Exception");
                    }
                });

                bo.SetValue(_property, command);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception);
                bo.SetValue(_property, null);
            }
        }
Пример #4
0
 private void NextFrame()
 {
     CurrentFrame++;
     if (CurrentFrame != _totalFrames)
     {
         return;
     }
     CurrentFrame = 0;
     _isEnd       = true;
     EndAnimation?.Invoke();
     //EndAnimation = null;
 }
Пример #5
0
 /// <summary>
 ///		Ejecuta las acciones de una línea de tiempo
 /// </summary>
 internal void Execute(TimeLineModel timeLine)
 {
     // Si no existía ninguna animación se crea
     if (_animationProcessor == null)
     {
         // Crea el objeto
         _animationProcessor = new TimeLineProcessor(this, UseAnimation);
         // Asigna los manejadores de eventos
         _animationProcessor.AnimationStart += (sender, evntArgs) =>
         {
             StartAnimation?.Invoke(this, EventArgs.Empty);
             IsPlayingAnimation = true;
         };
         _animationProcessor.AnimationEnd += (sender, evntArgs) =>
         {
             EndAnimation?.Invoke(this, EventArgs.Empty);
             IsPlayingAnimation = false;
         };
     }
     // Ejecuta la animación
     _animationProcessor.Execute(timeLine);
 }
        public override async Task <bool> StartTask()
        {
            var actorFound     = FindActor();
            var positionResult = await base.StartTask();

            // Prioritize provided Abs/Rel position before trying to move to found actor,
            // ensures specific actor is used when there are multiple of same type.

            if (positionResult)
            {
                if (!actorFound)
                {
                    return(true);
                }

                _movementTask = new MoveToActorCoroutine(QuestId, AdvDia.CurrentWorldId, ActorId, (int)MaxRange, Explore, CheckActorAnimation, StopDistance, MarkerHash);
            }

            _endAnimLower   = EndAnimation?.ToLowerInvariant() ?? string.Empty;
            _startAnimLower = StartAnimation?.ToLowerInvariant() ?? string.Empty;

            return(false);
        }
Пример #7
0
 void Awake()
 {
     _animation = AnimationToPlayAtLastSale;
     thisO = this;
 }
Пример #8
0
 void Awake()
 {
     _animation = AnimationToPlayAtLastSale;
     thisO      = this;
 }
        // Update is called once per frame
        void FixedUpdate()
        {
            if (Frozen)
            {
                return;
            }


            float h = Input.GetAxisRaw("Horizontal");
            float v = 0f;

            if (Math.Abs(h) < 0.0001f)
            {
                v = Input.GetAxisRaw("Vertical");
            }


            PlayerAnimator.SetInteger("Vertical", Mathf.RoundToInt(v));
            PlayerAnimator.SetInteger("Horizontal", Mathf.RoundToInt(h));

            Vector3 inputs = new Vector3(h, v);


            if (inputs.magnitude > 0)
            {
                _raycastRay.origin    = _playerTransform.position;
                _raycastRay.direction = (_playerTransform.position + inputs) - _raycastRay.origin;
            }

            inputs *= Speed;
            inputs *= Input.GetAxisRaw("Run") > 0 ? _runSpeedMultiplier : 1f;
            inputs *= Time.fixedDeltaTime;

            if (Input.GetAxisRaw("Fire") > 0 && _snowballTimer >= _snowBallCooldown)
            {
                Vector3 dest = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                dest.z = -5;
                GameObject instance = Instantiate(_snowBallPrefab, transform.position + inputs, Quaternion.identity);
                instance.transform.DOMove(dest, 0.5f).SetEase(Ease.Linear).OnComplete(() =>
                {
                    Destroy(instance);
                });
                _snowballTimer = 0;
            }
            _snowballTimer += Time.deltaTime;
            _body.velocity  = inputs;

            if (!(Input.GetAxis("Interact") > 0))
            {
                return;
            }
            RaycastHit raycastHit;

            if (!Physics.Raycast(_raycastRay, out raycastHit, _raycastRange))
            {
                return;
            }

            if (raycastHit.transform.CompareTag("InteractiveObject"))
            {
                InteractiveObject obj = raycastHit.transform.GetComponent <InteractiveObject>();
                if (obj != null)
                {
                    obj.Interact();
                }

                LevelLoader lvl = raycastHit.transform.GetComponent <LevelLoader>();
                if (lvl != null)
                {
                    lvl.LoadLevel();
                }

                EndAnimation endAn = raycastHit.transform.GetComponent <EndAnimation>();
                if (endAn != null)
                {
                    endAn.PlayEndAnimation();
                }
            }
        }
Пример #10
0
 private static void AfterWakeUp()
 {
     EndAnimation.Invoke();
     timer = new Timer(TimerCallback, "KissingTimer", TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(1));
     rand  = new System.Random(randSeed);
 }
Пример #11
0
 protected virtual void OnEndAnimation(EventArgs e)
 {
     EndAnimation?.Invoke(this, e);
 }