C'est un peu osé ce que je vais vous demander et vous allez peut être m'envoyer balader mais je tente quand meme le coup,
J'ai recemment téléchargé et importé des assets dans l'asset store, un personnage avec animations etc. et je suis en train d'essayer de mettre les animations sur le personnage, j'ai commencé par creer un animator ect ect ect. MAIS j'ai fait tout ca pour rien car il y avait deja un script pour les animations sauf que c'est un script de demo c'est-à-dire que je dois appuier sur des boutons pour jouer l'animation et moi je veut faire en sorte que quand le personnage marche, il y ait l'animation ect. donc je dois comprendre le script de demo et c'est là que ca bloque car JE NE COMPREND ABSOLUMENT RIEN ( il faut dire que je ne suis pas un exper sur unity et je debute encore ) donc j'aurais besoin de votre aide pour comprendre ce code ( c'est du javascript ) :
Code : Tout sélectionner
#pragma strict
var roteSpeed:float = 0.0;
var animationSpeed:float =1.0;
private var animationCount:uint;
private var animationList:Array;
function Start () {
print("animationGetCount:" + GetComponent(Animation).GetClipCount());
print(GetComponent(Animation).clip.name);
animationCount = GetComponent(Animation).GetClipCount();
print(gameObject.GetComponent(Animation));
animationList = GetAnimationList();
}
function Update () {
transform.eulerAngles.y += roteSpeed;
}
function OnGUI (){
var margin : int = 10;
//Buttons
var buttonSpace:int = 25;
var rectWidth:int = 100;
var rectHeight:int = 40;
var max:int = 10;
var rects:Array = new Array();
var i:int = 0;
for (var name : String in animationList)
{
var rect:Rect = Rect(15,margin + 20*i + buttonSpace*i, rectWidth,rectHeight);
if(GUI.Button(rect,animationList[i].ToString())){
GetComponent(Animation).CrossFade(animationList[i],0.01);
}
i++;
}
}
private function GetAnimationList():Array
{
var tmpArray = new Array();
for (var state : AnimationState in gameObject.GetComponent(Animation))
{
tmpArray.Add(state.name);
}
return tmpArray;
}
J'ai vraiment besoin d'aide car je n'y arriverai pas tout seul.
Merci d'avance pour votre aide
Merci
Merci
Merci