- Home /
Need help with networking
Hi, My name is andys, i'm working in an Animation script, i have a problem with punch animations, the problem is: the attack animations won'w work and the player plays other animation, but idle, walk , works perfect, even swim animations, well i use Crossfade for the animation what works good and the attack animation i'm using CrossFade and i have a network view attached to the character with the animation on it, well here's the code, the code works perfect offline, sorry for my bad english.
animation.CrossFade("blablbla");// works
animation.Play("bla bla bla ");// plays other animation
im having a hard time getting what is wrong. Not to worry, we'll work through it. Is it when other players look at you punch it doesnt appear as a punch to them?
and now after i walk again after attack appear as swi$$anonymous$$g -.- damm
well i see the problem start wheni call the attack script
Answer by lancer · Apr 18, 2014 at 05:34 PM
I think, from what you have posted, that you will need to set the network view to observe the script. Also you should be sending it serialization so the other player knows what your player is doing.
@script AddComponent$$anonymous$$enu("Naruto$$anonymous$$mo/Controladores personajes/Controlador Animacion")
//enumeracion de los estados
var puedeCambiar : boolean;
var atacando : boolean;
var animNombre : String;
function idle(w : boolean)
{
if(!w){
if(atacando){
animation.CrossFade("idle_taijutsu", 0.2, Play$$anonymous$$ode.StopAll);
}else{
animation.CrossFade("idle2", 0.2, Play$$anonymous$$ode.StopAll);
}
}else{
animation.CrossFade("idleNadar", 1, Play$$anonymous$$ode.StopAll);
}
}
function ca$$anonymous$$ar(r : boolean, v : boolean)
{
animation["walk"].speed = 1.0;
if(r){
animation["walk"].speed = -1.0;
}
animation.CrossFade("walk", 0.2, Play$$anonymous$$ode.StopAll);
}
function ca$$anonymous$$arLado(r : boolean)
{
animation["SideWalk"].speed =1;
if(r){animation["SideWalk"].speed =-1;}
animation.CrossFade("SideWalk",0.1);
}
function correr(f : boolean , r : boolean)
{
if(r)
{
animation["run"].speed = -1.0;
}else{
animation["run"].speed = 1.0;
}
if(f)
{
animation.CrossFade("runfast",0.05,Play$$anonymous$$ode.StopAll);
}else{
animation.CrossFade("run",0.1,Play$$anonymous$$ode.StopAll);
}
}
function nadarAdelante(b : boolean,f: boolean , d : boolean,normal : boolean)
{
if(normal){
if(f){
animation["nadar"].speed = 1.0;
animation["nadarRapido"].speed = 1.0;
if(!b){
animation.CrossFade("nadar", 0.2, Play$$anonymous$$ode.StopAll);
}else{
animation.CrossFade("nadarRapido", 0.2, Play$$anonymous$$ode.StopAll);
}
}else{
animation["nadarAtras"].speed = 1;
animation.CrossFade("nadarAtras", 0.2, Play$$anonymous$$ode.StopAll);
}
}else if(d)
{
animation["nadarAbajo"].speed = 1;
animation.CrossFade("nadarAbajo", 0.5, Play$$anonymous$$ode.StopAll);
}
}
function saltar()
{
animation.CrossFade("jumpFlip",0.1);
return animation["jumpFlip"].length * 3;
}
function caer()
{
animation.CrossFade("fall",0.1,Play$$anonymous$$ode.StopAll);
}
function caerSuelo() // c es si cae si es false inicia el salto , s de speed si va corriendo
{
animation["jumpStart"].speed = 1.0;
animation.CrossFade("jumpStart",0.1,Play$$anonymous$$ode.StopAll);
return animation["jumpStart"].length / 1.7;
}
function dodge(f : boolean, s : float)
{
if(f){animation.Play("Flip");}
else{
animation["dodge"].speed = s;
animation.Play("dodge",Play$$anonymous$$ode.StopAll);
}
return animation["dodge"].length;
}
function taijutsu(g : String,h : int, a : boolean)
{
animNombre = (g + h);
if(a)
{
animNombre = "air"+animNombre;
}
animation[animNombre].layer = 1;
animation.Play(animNombre,Play$$anonymous$$ode.StopAll);
return animation[animNombre].length;
}
Your answer
Follow this Question
Related Questions
Synchronizing objects over the network 4 Answers
How do i animate threw network 1 Answer
Problem with Unity Network syncrhonization 0 Answers
Network Animator set trigger not working 2 Answers
Network Animator not working 0 Answers