// Use this for initialization void Start() { audios = GetComponents <AudioSource>(); flame = transform.Find("Flame").GetComponent <ParticleSystem>(); slip = transform.Find("Slip").GetComponent <ParticleSystem>(); // dust = transform.Find("Dust").GetComponent<ParticleSystem>(); Vector2 min = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)); Vector2 max = Camera.main.ViewportToWorldPoint(new Vector2(1, 1)); Player.print("width:" + min.x + " , " + max.x); Player.print("height:" + min.y + " , " + max.y); //StartCoroutine(initPlayers()); // SpriteRenderer spriteRenderer = GetComponent<Renderer>() as SpriteRenderer; int charIndex = 0; for (int i = 0; i < BasicPlayerInfo.instance.CharacterDiscription.Length; i++) { if (role == BasicPlayerInfo.instance.CharacterDiscription[i]) { charIndex = i; break; } } //if (role == "ninja") // spriteRenderer.sprite = sprites[0]; // else if (role == "hunter") // spriteRenderer.sprite = sprites[1]; // else if (role == "enchanter") // spriteRenderer.sprite = sprites[2]; // else if (role == "thief") // spriteRenderer.sprite = sprites[3]; CmdInitializeAll(); maincamera = Camera.main; m_RigidBody2D = GetComponent <Rigidbody2D>(); armatureComponent = GetComponent <UnityArmatureComponent>(); Player.print("eyes" + eyes + "char" + charIndex + "skin" + skin); BasicPlayerInfo.UpdateEyes(eyes, armatureComponent); BasicPlayerInfo.UpdateChar(charIndex, armatureComponent); BasicPlayerInfo.UpdateColor(skin, armatureComponent); int index = 1; GameObject[] objs = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject gameObj in objs) { Player p = gameObj.GetComponent <Player>(); p.GetComponent <UnityArmatureComponent>().transform.position = new Vector3(0.0f, 0.0f, -15.0f + index); index++; if (p.isLocalPlayer) { armatureComponent.transform.position = new Vector3(0.0f, 0.0f, -15.0f); } } items = new List <string>(); speedmul = 0.5f; initPlayers(); // Warning!!!! make all character's slot as 1 slots = 1; }
public void ChgCharBtnOnClick() { BasicPlayerInfo.instance.characterIndex += 1; BasicPlayerInfo.instance.characterIndex %= BasicPlayerInfo.characterRange; if (armatureComponent) { BasicPlayerInfo.UpdateChar(BasicPlayerInfo.instance.characterIndex, armatureComponent); armatureComponent.animation.Play("Excited", 1); } GameObject.Find("Char").GetComponentInChildren <Text> ().text = BasicPlayerInfo.instance.CharacterDiscription[BasicPlayerInfo.instance.characterIndex]; }
// Use this for initialization void Start() { alert.SetActive(false); playerNameInput.text = BasicPlayerInfo.instance.playerName; buttons[BasicPlayerInfo.instance.characterIndex].onClick.Invoke(); buttons[BasicPlayerInfo.instance.characterIndex].Select(); UnityFactory.factory.LoadDragonBonesData("MarvinCat/MarvinCat_ske"); UnityFactory.factory.LoadTextureAtlasData("MarvinCat/MarvinCat_tex"); armatureComponent = UnityFactory.factory.BuildArmatureComponent("MarvinCat"); BasicPlayerInfo.UpdateEyes(BasicPlayerInfo.instance.eyesIndex, armatureComponent); BasicPlayerInfo.UpdateChar(BasicPlayerInfo.instance.characterIndex, armatureComponent); BasicPlayerInfo.UpdateColor(BasicPlayerInfo.instance.colorIndex, armatureComponent); armatureComponent.animation.Play("JumpBlink", 1); armatureComponent.transform.localPosition = new Vector3(-1.0f, -1.0f, -7.0f); armatureComponent.transform.localScale = new Vector3(0.8f, 0.8f, 2.0f); //armatureComponent.DispatchEvent(UnityEngine.EventType.MouseDown, ) //armatureComponent.AddEventListener (UnityEngine.EventType.MouseDown, AnimationController.PlayRandomEventHandler); armatureComponent.gameObject.AddComponent <AnimationController>(); BoxCollider box = armatureComponent.gameObject.AddComponent <BoxCollider> (); box.size = new Vector3(2.0f, 4.0f, 1.0f); box.center = new Vector3(0.0f, 1.0f, 0.0f); }