コード例 #1
0
    public void Play(AnimationClip clip)
    {
        var state = AnimancerComponent.States.GetOrCreate(clip);

        state.Speed = Speed;
        AnimancerComponent.Play(state);
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        CombatEntity.Position = transform.position;

        AnimTimer.UpdateAsFinish(Time.deltaTime);
        if (!AnimTimer.IsFinished)
        {
            //return;
        }

        //var h = Input.GetAxis("Horizontal");
        //var v = Input.GetAxis("Vertical");
        //if (h != 0f || v != 0f)
        //{
        //    MoveTweener?.Kill();
        //    h *= MoveSpeed * 0.02f;
        //    v *= MoveSpeed * 0.02f;
        //    var p = transform.position;
        //    transform.position = new Vector3(p.x + h, 0, p.z + v);
        //}

        if (Input.GetMouseButtonDown((int)MouseButton.RightMouse))
        {
            if (RaycastHelper.CastMapPoint(out var point))
            {
                var time = Vector3.Distance(transform.position, point) * MoveSpeed * 0.5f;
                MoveTweener?.Kill();
                MoveTweener = transform.DOMove(point, time).SetEase(Ease.Linear).OnUpdate(() => { transform.GetChild(0).DOLookAt(point, 0.2f); }).OnComplete(() => { AnimancerComponent.Play(IdleAnimation, 0.25f); });
                AnimancerComponent.Play(RunAnimation, 0.25f);
            }
        }
    }
コード例 #3
0
 public void Play(AnimationClip clip)
 {
     AnimancerComponent.Play(clip);
 }