Ejemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         mecanimControl.Play("Idling", 1f, 0.1f, false);
         Debug.Log("待機");
     }
     else if (Input.GetKeyDown(KeyCode.S))
     {
         mecanimControl.Play("a", 1f, 0.1f, false);
         Debug.Log("剣で攻撃");
     }
     else if (Input.GetKeyDown(KeyCode.D))
     {
         mecanimControl.Play("a2", 1f, 0.1f, false);
         Debug.Log("ハンマーで攻撃");
     }
     else if (Input.GetKeyDown(KeyCode.F))
     {
         mecanimControl.Play("walk", 1f, 0.1f, false);
         Debug.Log("walk");
     }
     else if (Input.GetKeyDown(KeyCode.G))
     {
         mecanimControl.Play("idlng", 1f, 0.1f, false);
         Debug.Log("walk");
     }
 }
Ejemplo n.º 2
0
    /*---------------------------------------------------------------*/

    public void ChangePose(int poseIndex, float speed = 1.0f, float blend = 0.15f)
    {
        if (!emitorFlag)
        {
            mecanimControl.Play(mecanimControl.animations[poseIndex], blend);
            mecanimControl.SetSpeed(speed);
            StartCoroutine(Emitor());              // avoid frequent transition
        }
    }
    void OnGUI()
    {
        GUILayout.Label("Speed (" + animSpeed + ")");
        animSpeed = GUILayout.HorizontalSlider(animSpeed, 0, 10f);
        mecanimControl.SetSpeed(animSpeed);

        GUILayout.Label("Rotation (" + currentRotation + ")");
        currentRotation            = GUILayout.HorizontalSlider(currentRotation, 0.0f, 360.0f);
        transform.localEulerAngles = new Vector3(0.0f, currentRotation, 0.0f);

        GUILayout.Label("Blending (" + blendDuration + ")");
        blendDuration = GUILayout.HorizontalSlider(blendDuration, 0, 1f);
        mecanimControl.defaultTransitionDuration = blendDuration;

        GUILayout.Space(10);

        if (GUILayout.Button("Mirror " + mirror))
        {
            mirror = !mirror;
            mecanimControl.SetMirror(mirror);
        }

        if (GUILayout.Button("Debug " + mecanimControl.debugMode))
        {
            mecanimControl.debugMode = !mecanimControl.debugMode;
        }

        GUILayout.Space(10);

        foreach (AnimationData animationData in mecanimControl.animations)
        {
            if (GUILayout.Button(animationData.clipName))
            {
                mecanimControl.Play(animationData, mirror);
            }
        }
    }