mercredi 10 février 2021

Unity Error CS1520: Method must have a return type

//I'm trying to trigger the transition from an idle animation to a running animation when the "d" button is being pressed. (A link to a tutorial covering a transition like this could also work).//

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

    public class IdleToJump : MonoBehaviour
{
    bool keyHold = false;
    public Form1()
    {
    InitializeComponent();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
    if (keyHold == true)
    {
        anim.Play("Run_Anim");
    }
}

private void Key_up(object sender, KeyEventArgs e)
{
    Key key = (Key)sender;
    if (key == "d") {
        keyHold = false;
    }
    }

    private void Key_down(object sender, KeyEventArgs e)
    {
        Key key = (Key)sender;
        if (key == "d")
        {
            keyHold = true;
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire