void Handle_GunFire(Player p, Gun g, int score) { //Debug.Log("Handle_GunFire"); Bullet prefabBullet = ModuleBullet.Get_PrefabBullet_Used(g); //tk2dAnimatedSprite ani; if (prefabBullet == null) { return; } GunLevelType gLvType = g.GetLevelType(); GunPowerType gPowerType = g.GetPowerType(); int NumInstance = 2 + (int)gLvType;//生成的数量 float widthBullet = WidthBulletNormal[(int)g.GetLevelType()]; Vector3 posOffset = new Vector3(-widthBullet * NumInstance / 2F, 0F); for (int i = 0; i != NumInstance; ++i) { Bullet b = Pool_GameObj.GetObj(prefabBullet.gameObject).GetComponent <Bullet>(); b.Prefab_GoAnisprBullet = Prefab_AniBullet; b.Prefab_SpriteNameSet = gPowerType == GunPowerType.Normal ? nameSetAniBulletNor : nameSetAniBulletLizi; BulletEx_Splitor bEx_Splitor = b.gameObject.AddComponent <BulletEx_Splitor>(); bEx_Splitor.FactorSplit = NumInstance; b.transform.position = g.local_GunFire.position + g.AniSpr_GunPot.transform.rotation * posOffset; posOffset.x += widthBullet; b.Score = score; b.Fire(p, null, g.AniSpr_GunPot.transform.rotation); } }
// Use this for initialization void Start() { // Text_Score.text = GameMain.Singleton.BSSetting.Dat_PlayersScore[Idx].Val.ToString(); // Text_Score.Commit(); if (GameMain.Singleton.BSSetting.Dat_PlayersScoreWon[Idx].Val != 0) { //Ef_CoinStack.OneStack_SetNum(GameMain.Singleton.BSSetting.Dat_PlayersScoreWon[Idx].Val); StartCoroutine(_Coro_OutBountyImm()); } //初始化Gun GunLevelType glt = Gun.GunNeedScoreToLevelType(GameMain.Singleton.BSSetting.Dat_PlayersGunScore[Idx].Val); GunType gt = Gun.CombineGunLevelAndPower(glt, GunPowerType.Normal); //if (GameMain.Singleton.BSSetting.Dat_PlayersGunScore[Idx].Val >= Defines.ChangeGunNeedScoreTri) if (GunInst != null) { Destroy(GunInst.gameObject); } GunInst = Instantiate(Prefab_Guns[(int)gt]) as Gun; GunInst.GunType_ = gt; GunInst.transform.parent = transform; GunInst.transform.localPosition = Vector3.zero; GunInst.transform.localRotation = Quaternion.identity; //if (mFishLocker != null) // mFishLocker.EvtRelock += (Fish f) => { GunInst.LockAt(f); }; }
/// <summary> /// 改变押分 /// </summary> /// <returns></returns> IEnumerator _Coro_ChangeNeedScore() { if (!CanChangeScore) { yield break; } BackStageSetting bss = GameMain.Singleton.BSSetting; GunLevelType preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.AdvanceNeedScore(); GunLevelType curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } yield return(new WaitForSeconds(0.2F)); while (CanChangeScore) { preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.AdvanceNeedScore(); curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } yield return(new WaitForSeconds(0.1F)); } }
public static GunType CombineGunLevelAndPower(GunLevelType glt, GunPowerType gpt) { switch (glt) { case GunLevelType.Dbl: switch (gpt) { case GunPowerType.Normal: return GunType.Normal; case GunPowerType.Lizi: return GunType.Lizi; } break; case GunLevelType.Tri: switch (gpt) { case GunPowerType.Normal: return GunType.NormalTri; case GunPowerType.Lizi: return GunType.LiziTri; } break; case GunLevelType.Quad: switch (gpt) { case GunPowerType.Normal: return GunType.NormalQuad; case GunPowerType.Lizi: return GunType.LiziQuad; } break; } return GunType.Normal; }
public void ChangeNeedScore(int newScore) { BackStageSetting bss = GameMain.Singleton.BSSetting; GunLevelType preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.SetNeedScore(newScore); GunLevelType curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } }
public static GunType CombineGunLevelAndPower(GunLevelType glt, GunPowerType gpt) { switch (glt) { case GunLevelType.Dbl: switch (gpt) { case GunPowerType.Normal: return(GunType.Normal); case GunPowerType.Lizi: return(GunType.Lizi); } break; case GunLevelType.Tri: switch (gpt) { case GunPowerType.Normal: return(GunType.NormalTri); case GunPowerType.Lizi: return(GunType.LiziTri); } break; case GunLevelType.Quad: switch (gpt) { case GunPowerType.Normal: return(GunType.NormalQuad); case GunPowerType.Lizi: return(GunType.LiziQuad); } break; } return(GunType.Normal); }
/// <summary> /// 押分改变(自身触发) /// </summary> /// <param name="curScore"></param> void On_GunLevelTypeChanged(GunLevelType curType) { ChangeGun(curType, GunInst.GetPowerType()); }
public bool ChangeGun(GunLevelType lvType, GunPowerType pwrType) { return(ChangeGun(Gun.CombineGunLevelAndPower(lvType, pwrType))); }
public bool ChangeGun(GunLevelType lvType, GunPowerType pwrType) { return ChangeGun(Gun.CombineGunLevelAndPower(lvType, pwrType)); }
/// <summary> /// Ѻ�ָı�(�������) /// </summary> /// <param name="curScore"></param> void On_GunLevelTypeChanged(GunLevelType curType) { ChangeGun(curType, GunInst.GetPowerType()); }