public void Construct( [Inject(Id = Identifiers.Network)] CharacterFacade.Factory networkFactory, [Inject(Id = Identifiers.AI)] CharacterFacade.Factory AIFactory, [Inject(Id = Identifiers.Player)] CharacterFacade.Factory playerFactory, CameraManager cameraManager, UnityClient unityClient, AnimationControllers controllers ) { _controllers = controllers; _networkFactory = networkFactory; _playerFactory = playerFactory; _unityClient = unityClient; _cameraManager = cameraManager; _characters = new Dictionary <ushort, CharacterFacade>(); }
void onr(BaseEvent e) { string cmd=(string)e.Params["cmd"]; ISFSObject obj=(SFSObject)e.Params["params"]; if(cmd=="SpawnNewPlayer") { if (!GameObject.Find (obj.GetUtfString("name"))){ Debug.Log(obj.GetInt("userID")); Debug.Log(obj.GetFloat("varX")); Debug.Log(obj.GetFloat("varY")); Debug.Log(obj.GetFloat("varZ")); GameObject player = new GameObject(obj.GetUtfString("name")); Animation playerModel = Animation.Instantiate(Resources.LoadAssetAtPath("Assets/Objects/penelopeFBX.fbx",typeof(Animation)) )as Animation; playerModel.transform.parent = player.transform; player.AddComponent("CharacterController"); AnimationControllers anim = new AnimationControllers(); player.AddComponent("AnimationControllers"); anim = player.GetComponent("AnimationControllers") as AnimationControllers; anim.animationTarget = playerModel; float xv = obj.GetFloat("varX"); Vector3 v = new Vector3(obj.GetFloat("varX"),obj.GetFloat("varY"),obj.GetFloat("varZ")); player.transform.position = v; // Debug.Log(obj.GetInt("countlist")); } else if (obj.GetUtfString("name") == ConnectionGUI.username) { Debug.Log("extension response is coming"); Debug.Log(obj.GetInt("userID")); Debug.Log(obj.GetFloat("varX")); Debug.Log(obj.GetFloat("varY")); Debug.Log(obj.GetFloat("varZ")); Vector3 v = new Vector3(obj.GetFloat("varX"),obj.GetFloat("varY"),obj.GetFloat("varZ")); GameObject.Find (ConnectionGUI.username).transform.position = v; } } else if(cmd=="updatexyz") { //Debug.Log ("working update"); if (obj.GetUtfString("name") == ConnectionGUI.username) { } else{ Vector3 v = new Vector3(obj.GetFloat("varX"),0,obj.GetFloat("varZ")); if(GameObject.Find (obj.GetUtfString("name"))) { GameObject.Find (obj.GetUtfString("name")).transform.position = v; } else{ GameObject player = new GameObject(obj.GetUtfString("name")); Animation playerModel = Animation.Instantiate(Resources.LoadAssetAtPath("Assets/Objects/penelopeFBX.fbx",typeof(Animation)) )as Animation; playerModel.transform.parent = player.transform; player.AddComponent("CharacterController"); AnimationControllers anim = new AnimationControllers(); player.AddComponent("AnimationControllers"); anim = player.GetComponent("AnimationControllers") as AnimationControllers; anim.animationTarget = playerModel; float xv = obj.GetFloat("varX"); v = new Vector3(obj.GetFloat("varX"),0,obj.GetFloat("varZ")); player.transform.position = v; } } } }
//public CharBodyPart_AnimClips Rabbit1; public void Awake() { AnimControllers = this; }