Ejemplo n.º 1
0
    void OnGUI()
    {
        GUI.skin = m_skin;
        if (m_clips == null)
        {
            return;
        }
        var num  = 12;
        var open = false;

        for (var i = 0; i < m_clips.Count; i++)
        {
            var c = m_clips[i];

            if (i % num == 0)
            {
                GUILayout.BeginHorizontal();
                open = true;
            }
            if (GUILayout.Button(c.name))
            {
                m_sanim.CrossFade(c.name, 0.2f);
            }
            if (i % num == num - 1)
            {
                GUILayout.EndHorizontal();
                open = false;
            }
        }
        if (open)
        {
            GUILayout.EndHorizontal();
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        _simpleAnimation.CrossFade("walk", 1f);
        _simpleAnimation.CrossFade("jump", 0.2f);

        _simpleAnimation.Play("Default");
    }
Ejemplo n.º 3
0
    private void FixedUpdate()
    {
        m_Grounded = false;

        // The player is grounded if a circlecast to the groundcheck position hits anything designated as ground
        // This can be done using layers instead but Sample Assets will not overwrite your project settings.
        Collider2D[] colliders = Physics2D.OverlapCircleAll(m_GroundCheck.position, k_GroundedRadius, m_WhatIsGround);
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].gameObject != gameObject)
            {
                m_Grounded = true;
                simpleAnim.CrossFade(Idle, 0.1f);
                //simpleAnim.Play(Idle);
            }
        }

        // Set the vertical animation
        bool  crouch = Input.GetKey(KeyCode.LeftControl);
        float h      = CrossPlatformInputManager.GetAxis("Horizontal");

        m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
        Move(h, crouch, m_Jump);
        m_Jump = false;
    }
Ejemplo n.º 4
0
        //アニメーション変更(移動方向で変更)
        public virtual void ChangeAnim(Direction dir)
        {
            switch (dir)
            {
            case Direction.Front:

                _anim.CrossFade("Front", 0);
                break;

            case Direction.Left:

                _anim.CrossFade("Left", 0);
                break;

            case Direction.Right:

                _anim.CrossFade("Right", 0);
                break;

            case Direction.Back:

                _anim.CrossFade("Back", 0);
                break;
            }
        }
Ejemplo n.º 5
0
        //アニメーション変更(移動方向で変更)
        public virtual void ChangeAnim(Direction dir, float time)
        {
            //待機時間が1秒を超える
            if (time >= _waitTime)
            {
                _anim.CrossFade("LongWait", 0);
            }
            //1秒未満かつ0.3秒以上
            else if (time >= 0.2f)
            {
                switch (dir)
                {
                case Direction.Front:
                    _anim.CrossFade("FrontWait", 0);
                    break;

                case Direction.Left:
                    _anim.CrossFade("LeftWait", 0);
                    break;

                case Direction.Right:
                    _anim.CrossFade("RightWait", 0);
                    break;

                case Direction.Back:
                    _anim.CrossFade("BackWait", 0);
                    break;
                }
            }
            //それ未満
            else
            {
                switch (dir)
                {
                case Direction.Front:
                    _anim.CrossFade("Front", 0);
                    break;

                case Direction.Left:
                    _anim.CrossFade("Left", 0);
                    break;

                case Direction.Right:
                    _anim.CrossFade("Right", 0);
                    break;

                case Direction.Back:
                    _anim.CrossFade("Back", 0);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
 void Move()
 {
     if (moveVector.magnitude > 0.001)
     {
         simpleAnimation.CrossFade("run", 0.5f);
         transform.rotation = Quaternion.LookRotation(moveVector);
         transform.position = transform.position + moveVector;
     }
     else
     {
         simpleAnimation.CrossFade("idle", 0.5f);
     }
 }
Ejemplo n.º 7
0
 void OnEnable()
 {
     if (!_isLady)
     {
         return;
     }
     //再生中のアニメーションがあれば
     if (_animName != null)
     {
         //最後のアニメーションの再生位置を記憶しておいたものに変更
         _anim.GetState(_animName).normalizedTime = _animLastTime;
         //最後のアニメーション再生
         _anim.CrossFade(_animName, 0);
     }
 }
Ejemplo n.º 8
0
 private void Update()
 {
     if (Input.GetButtonDown("Atack"))
     {
         m_simpleAnimation.CrossFade("Atack", 0.1f);
         Debug.Log("atack");
     }
 }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            var ray = mainCamera.ScreenPointToRay(Input.mousePosition);

            RaycastHit Hit;
            if (Physics.Raycast(ray, out Hit, Mathf.Infinity))
            {
                if (simpleAnimation.IsPlaying("idle"))
                {
                    simpleAnimation.CrossFade("run", 0.5f);
                }
                else if (simpleAnimation.IsPlaying("run"))
                {
                    simpleAnimation.CrossFade("idle", 0.5f);
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        switch (m_moveState)
        {
        case MoveState.Patrol:
        {
            m_simpleAnimation.CrossFade("Walk", 0.2f);
            Patrol();
        }
        break;

        case MoveState.Chase:
        {
            m_simpleAnimation.CrossFade("Walk", 0.2f);
            Chase();
        }
        break;
        }

        //経路計算をさせるためにフラグを変更
    }
    // write your code below
    void pto(string anim, int f, float y = 0)
    {
        transform.position    = Vector3.up * y;
        transform.eulerAngles = Vector3.up * 180;
        if (m_sa == null)
        {
            m_sa = GetComponent <SimpleAnimation>();
        }
        var st = m_sa.GetState(anim);

        if (st != null)
        {
            st.normalizedTime = 0;
        }
        else
        {
            Debug.Log(anim + "!!!!!!!!!!!!");
        }
        m_sa.CrossFade(anim, 3f / 15f);
        m_cnt = f;
    }
Ejemplo n.º 12
0
    IEnumerator Start()
    {
        SoundManager.Play(SoundManager.SEClip.bossStart);

        yield return(new WaitForSeconds(3f));

        foreach (var state in simpleAnimation.GetStates())
        {
            nameList.Add(state.name);
        }

        // 一定時間ごとにアニメーションを繰り返す
        SetRepeatCall(() => !PlayData.bossDied, changeSpan, () => {
            int rnd = Random.Range(0, 3);
            // SE
            SoundManager.Play(SoundManager.SEClip.bossAtack1 + rnd);

            simpleAnimation.CrossFade(nameList[index], 0.5f);
            index++;
            index = Mathf.Clamp(index, 0, nameList.Count - 1);
        });
    }
Ejemplo n.º 13
0
 public void Kick(string name)
 {
     m_curstate = name;
     m_sanim.CrossFade(name, 0.2f);
 }
Ejemplo n.º 14
0
    private void Update()
    {
        if (m_rb.velocity.magnitude > m_limitSpeed)
        {
            Debug.Log("はやすぎ");
            m_rb.velocity = new Vector3(m_rb.velocity.x / m_decelerateSpeed, m_rb.velocity.y / m_decelerateSpeed, m_rb.velocity.z / m_decelerateSpeed);
        }

        switch (PlayerState.m_PlayerStates)
        {
        case PlayerStates.InGame:
            if (m_canmove)    //here
            {
                m_horizontal = Input.GetAxisRaw("Horizontal");
                m_virtical   = Input.GetAxisRaw("Vertical");
                if (Input.GetButtonDown("Sprint"))
                {
                    Debug.Log("SprintButtonPushed");
                    if (!IsSprint && !LockOnController.IsLock)
                    {    // m_rb.velocity = Vector3.zero;
                        IsSprint = true;
                    }
                    else
                    {
                        IsSprint = false;
                    }
                }

                if (Input.GetButtonDown("Atack"))
                {
                    m_isAtacking = true;
                }
            }
            break;

        case PlayerStates.OpenUi:
            break;

        default:
            break;
        }


        m_dir = Vector3.forward * m_virtical + Vector3.right * m_horizontal;
        if (m_dir == Vector3.zero)
        {
            m_rb.velocity = new Vector3(0f, m_rb.velocity.y, 0f);
        }
        else if (LockOnController.IsLock)
        {
            /*ロックオン状態だと敵を見ながら動く*/
            LockOnMoveUpdate();
        }
        else
        {
            NormalMoveUpdate();
        }

        if (IsGround())
        {
            Debug.Log($"接地している:{m_isInTheAir}");
            m_isInTheAir = false;

            if (Input.GetButtonDown("Jump"))
            {
                Jump();
            }
        }
        else
        {
            Debug.Log($"接地していない");
            m_isInTheAir = true;
        }

        /*simpleAnimationに関する処理*/
        if (m_simpleAnim)
        {
            if (!IsGround())
            {
                if (m_rb.velocity.y > 0)
                {
                    m_simpleAnim.CrossFade("JumpStart", 0.1f);
                }
                else if (m_rb.velocity.y < 0)
                {
                    m_simpleAnim.CrossFade("JumpMidAir", 0.1f);
                }
            }
            else
            {
                //if (m_horizontal != 0 || m_virtical != 0)
                //{
                //    if (IsSprint) m_simpleAnim.CrossFade("Sprint", 0.1f);
                //    else m_simpleAnim.CrossFade("Run", 0.1f);

                //    if (LockOnController.IsLock)
                //    {
                //        Debug.Log("居ずロック");
                //        switch (PlayerState.m_PlayerDirState)
                //        {
                //            case PlayerMovingDirection.Neutral:
                //                m_simpleAnim.CrossFade("Default", 0.1f);
                //                break;
                //            case PlayerMovingDirection.Forward:
                //                m_simpleAnim.CrossFade("WalkForward", 0.1f);
                //                Debug.Log("Forward");
                //                break;
                //            case PlayerMovingDirection.Right:
                //                m_simpleAnim.CrossFade("WalkRight", 0.1f);
                //                break;
                //            case PlayerMovingDirection.Left:
                //                m_simpleAnim.CrossFade("WalkLeft", 0.1f);
                //                break;
                //            case PlayerMovingDirection.Back:
                //                m_simpleAnim.CrossFade("WalkBack", 0.1f);
                //                break;
                //            default:
                //                break;
                //        }
                //    }
                //}
                //else if (m_horizontal == 0 && m_virtical == 0) m_simpleAnim.CrossFade("Default", 0.1f);

                Debug.Log($"再生中{m_simpleAnim.IsPlaying("Atack")}");

                switch (PlayerState.m_PlayerDirState)
                {
                case MovingDirection.Neutral:
                    if (m_isAtacking)
                    {
                        m_simpleAnim.CrossFade("Atack", 0.1f);
                    }
                    else
                    {
                        m_simpleAnim.CrossFade("Default", 0.1f);
                    }
                    break;

                case MovingDirection.Move:
                    if (IsSprint)
                    {
                        m_simpleAnim.CrossFade("Sprint", 0.1f);
                    }
                    else
                    {
                        m_simpleAnim.CrossFade("Run", 0.1f);
                    }
                    break;

                case MovingDirection.Forward:
                    m_simpleAnim.CrossFade("WalkForward", 0.1f);
                    break;

                case MovingDirection.Right:
                    m_simpleAnim.CrossFade("WalkRight", 0.1f);
                    break;

                case MovingDirection.Left:
                    m_simpleAnim.CrossFade("WalkLeft", 0.1f);
                    break;

                case MovingDirection.Back:
                    m_simpleAnim.CrossFade("WalkBack", 0.1f);
                    break;

                default:
                    break;
                }
            }
        }
    }