コード例 #1
0
 void Awake()
 {
     instance   = this;
     animator   = GetComponent <Animator> ();
     bearHeight = BoundaryInfo.Height(this.gameObject) / 2;
     print("Awake");
     print(animator);
 }
コード例 #2
0
    public void JumpOver(GameObject other, GameObject lookAt = null, float jumpPower = 1)
    {
        float   topOffset = (BoundaryInfo.Height(other) / 2f) + (bearHeight / 2f);
        Vector3 dest      = other.transform.position + new Vector3(0, topOffset, 0);

        print("Jump to " + other + " " + dest);

        transform.DOKill(true);          // Stop current movement.
        transform.DOJump(dest, jumpPower, 1, 1f)
        .SetEase(Ease.OutQuart).OnComplete(() => {
            if (lookAt)
            {
                transform.LookAt(lookAt.transform);
            }
        });

        currentIceburg = other.GetComponent <Iceburg> ();
        if (currentIceburg)
        {
            currentIceburg.melt = true;
        }
        animator.Play("Jump");
    }