public void GoldCoinEffect(int num, int count) { for (int i = 0; i < num; i++) { Vector3 pos = MapGrid.GetMG(m_Attr.Pos).pos; //+new Vector3(Random.Range(1,m_Attr.Size*0.5f-2),-0.5f,1f); pos += new Vector3(0, 0.25f, 1.2f); pos = BattleEnvironmentM.Local2WorldPos(pos); int n = (int)count / num; if (i == 0) { n += count - num * ((int)count / num); } GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000041", EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); //EffectCamera.AddFollowList(gae.transform,pos); if (gae != null) { GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0)); gae.AddAction(gaw); GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI(); gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, ResourceType.Gold); gae.AddAction(gar); GameObject coin = U3DUtil.FindChild(gae.gameObject, "coin"); if (coin != null) { coin.GetComponent <ParticleSystem>().startDelay = Random.Range(1f, 1.5f); } } } }
// Use this for initialization void Start() { if (m_uicamera == null) { m_uicamera = WndManager.GetNGUICamera(); } if (m_gameCamera == null) { m_gameCamera = NGUITools.FindCameraForLayer(gameObject.layer); } m_timeCount = 0; }
public static bool IsHitNGUI(out RaycastHit hit) { if (null == WndManager.GetNGUICamera()) { hit = new RaycastHit(); return(false); } Camera camera = WndManager.GetNGUICamera(); Ray ray = WndManager.GetNGUICamera().ScreenPointToRay(Input.mousePosition); if (!Physics.Raycast(ray, out hit, camera.farClipPlane - camera.nearClipPlane, 1 << LayerMask.NameToLayer("NGUICamera"))) { return(false); } return(true); }
/// <summary> /// 删除 飞行仓库表现 /// </summary> /// <param name="go"></param> /// <param name="IsMoveChild">是否移动的是子对象(处理兵的特殊处理)</param> void FlyToCangKuDelete(GameObject go, bool IsMoveChild = false) { if (go) { CangKuWnd wnd = WndManager.FindDialog <CangKuWnd>(); if (wnd) { //Screen.width/2,0) Vector3 UIPos = WndManager.GetNGUICamera().ScreenToWorldPoint(new Vector3(Screen.width / 2, 0, 0)); GameObjectActionExcute gae = go.AddComponent <GameObjectActionExcute>(); GameObjectAction3DFlyToUI flyToUI = new GameObjectAction3DFlyToUI(); flyToUI.SetData(Camera.main, WndManager.GetNGUICamera(), UIPos, IsMoveChild); gae.AddAction(flyToUI); } else { Destroy(go); } } }
Transform SetEffect(StageClickType type, int ID) { string path = ""; if (type == StageClickType.Room) { path = "Textures/room/"; } else if (type == StageClickType.Role || type == StageClickType.Captain) { path = "Textures/role/"; } else if (type == StageClickType.Item) { path = "Textures/item/"; } GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "DropReward", m_target.transform.position + m_EndPos, BattleEnvironmentM.GetLifeMBornNode(true)); if (gae != null) { gae.transform.localScale = m_StartScale; Sprite s = GameObjectLoader.LoadSprite(path, ID.ToString()); if (s != null) { foreach (SpriteRenderer r in gae.gameObject.GetComponentsInChildren <SpriteRenderer>()) { r.sprite = s; } } GameObjectActionWait gaw = new GameObjectActionWait(1.0f); gae.AddAction(gaw); GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI(); gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), 1, ResourceType.Box); gae.AddAction(gar); return(gae.transform); } return(null); }
static void DropResourceEffect(string name, ResourceType t, int num, int count, Vector3 pos) { pos = BattleEnvironmentM.Local2WorldPos(pos); pos.x -= num / 2f; for (int i = 0; i < num; i++) { int n = (int)count / num; if (i == 0) { n += count - num * ((int)count / num); } pos.x += 1; //Random.Range(0,2) == 0 ? - Random.Range(0,0.5f*num):Random.Range(0,0.5f*num); pos.z = 0; GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", name, EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true)); //EffectCamera.AddFollowList(gae.transform,pos); if (gae != null) { Random.seed++; GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0)); gae.AddAction(gaw); GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI(); gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, t); gae.AddAction(gar); Animator ani = gae.gameObject.GetComponent <Animator>(); if (null != ani) { int nValue = (int)Random.value % 2; if (nValue == 0) { nValue = 2; } ani.SetInteger("iState", nValue); } } } }