public void recTeleport(KBEngine.Role e) { if (e.isPlayer()) { return; } if (e.renderObj == null) { return; } GameObject player = e.renderObj as GameObject; Instantiate(teleportEffect, player.transform.position, player.transform.rotation, player.transform); }
public void onRoleEnterWorld(UInt64 rndUUID, Int32 eid, KBEngine.Role entity) { Debug.Log("当前玩家[" + entity.id + "]进入游戏世界..."); //instantiate float y = entity.position.y; if (entity.isOnGround) { y = 1.3f; } Vector3 pos = new Vector3(entity.position.x, y, entity.position.z); GameObject hero = Resources.Load("Prefabs/Heros/" + entity.role_name) as GameObject; GameObject player = Instantiate(hero, pos, entity.rotation) as GameObject; entity.renderObj = player; //set init props set_position(entity); set_direction(entity); //set sync entity player.GetComponent <SyncPosRot>().entity = entity; player.GetComponent <SyncPosRot>().enabled = true; //set local controll bool isPlayer = entity.isPlayer(); player.GetComponent <SyncPosRot>().isLocalPlayer = isPlayer; player.GetComponent <BloodHUD>().enabled = !isPlayer; player.GetComponent <RoleHUD>().enabled = isPlayer; getPlayerController(entity).isLocalPlayer = isPlayer; if (isPlayer) { player.tag = "localPlayer"; loadRoleSkillIcon(entity); } else { player.tag = "nonLocalPlayer"; } }
public void recShot(KBEngine.Role e, Byte res, Double timestamp) { if (e.isPlayer()) { return; } if (res == 0) { if (othersArrowsDic.ContainsKey(timestamp)) { List <GameObject> otherArrows = othersArrowsDic[timestamp]; for (int i = 0; i < otherArrows.Count; i++) { otherArrows[i].GetComponent <Renderer>().enabled = true; } otherArrows.Clear(); othersArrowsDic.Remove(timestamp); } } }
public void onRoleEnterWorld(UInt64 rndUUID, Int32 eid, KBEngine.Role entity) { Debug.Log("当前玩家[" + entity.id + "]进入游戏世界..."); //instantiate float y = entity.position.y; if (entity.isOnGround) { y = 1.3f; } Vector3 pos = new Vector3(entity.position.x, y, entity.position.z); GameObject player = Instantiate(playerPrefab, pos, entity.rotation) as GameObject; entity.renderObj = player; //set init props set_position(entity); set_direction(entity); set_entityName(entity); set_moveSpeed(entity); player.GetComponent <Renderer>().material.mainTexture = Resources.Load <Texture>("pic/" + ((Role)entity).career_name); //set sync entity player.GetComponent <SyncPosRot>().entity = entity; player.GetComponent <SyncPosRot>().enabled = true; //set local controll if (entity.isPlayer()) { ctrlCamera.GetComponent <GameInput>().m_Player = player; ctrlCamera.GetComponent <GameInput>().enabled = true; player.GetComponent <SyncPosRot>().isLocalPlayer = true; } }