public void OnChangeCannon(bool bLocal, byte typeId, byte level, uint bulletCost) { if (m_Cannon != null) { GameObject.Destroy(m_Cannon.gameObject); } Transform tfm = m_InfoUI.Find("Anime_paotai"); m_Cannon = Fishing_Cannon.Create(GameBase.FishingAssetBundle, tfm, typeId, level, bLocal ? bulletCost : 0); m_Cannon.BelongRole = this; tfm = m_InfoUI.Find("right/Own"); tfm.gameObject.SetActive(bLocal); tfm = m_InfoUI.Find("Middle/ButtonBG_lv/ImageBG/TextNum"); tfm.GetComponent <Text>().text = bulletCost.ToString(); m_LvAddBtn.transform.parent.gameObject.SetActive(bLocal); if (bLocal) { m_LvAddBtn.interactable = true; m_LvSubBtn.interactable = true; GameBase.SetAutoFire(false); } }
public void OnCatch(Fishing_Cannon cannon, bool bLocal, long reward, FishType_Enum fishType, byte getSkillId, int specialId) { if (m_CatchRole != null) { return; } m_CatchRole = cannon.BelongRole; m_Animator.SetTrigger("die"); gameObject.layer = 0;//no collide m_SplineMove.Stop(); m_CatchRole.GameBase.OnLockFishLost(new List <byte>(m_LockSitList)); if (bLocal && fishType > FishType_Enum.FishType_Boss) { m_CatchRole.GameBase.StartLottery(fishType, specialId); } else { Canvas cv = m_CatchRole.GameBase.GameCanvas; Vector3 pos = GameFunction.WorldToLocalPointInRectangle(transform.position, Camera.main, cv, cv.worldCamera); if (fishType == FishType_Enum.FishType_Lottery) { getSkillId = RoomInfo.NoSit; } GameMain.SC(PopCoin(this, Fishing_Data.GetInstance().m_FishData[m_nTypeId], bLocal, reward, pos, m_CatchRole.GetCoinPos(), getSkillId)); } float deadTime = 3f; m_CatchRole.GameBase.m_AddItems.Add(gameObject); if (bLocal && m_DeadSound != null) { m_DeadSound.volume = AudioManager.Instance.SoundVolume; m_DeadSound.Play(); deadTime = m_DeadSound.clip.length; } GameMain.WaitForCall(deadTime, () => { m_CatchRole.GameBase.m_AddItems.Remove(gameObject); OnDeath(this); }); }
public static Fishing_Cannon Create(AssetBundle ab, Transform parent, byte id, byte level, uint bulletCost) { FishingCannonData fcd = Fishing_Data.GetInstance().m_CannonData[id]; GameObject obj = (GameObject)ab.LoadAsset(fcd.m_szCannon); obj = ((GameObject)GameMain.instantiate(obj)); obj.transform.SetParent(parent, false); obj.transform.Find(fcd.m_szLvPoint).GetComponent <UnityEngine.UI.Text>().text = level.ToString(); Fishing_Cannon fc = obj.AddComponent <Fishing_Cannon>(); fc.m_Data = fcd; fc.m_nTypeId = id; fc.m_nBulletCost = bulletCost * (uint)fcd.m_szBulletPoint.Length; if (fcd.m_nAudio != 0) { AudioSource audioSrc = obj.AddComponent <AudioSource>(); audioSrc.clip = ab.LoadAsset <AudioClip>(CustomAudioDataManager.GetInstance().GetSoundName(fcd.m_nAudio)); } return(fc); }