コード例 #1
0
    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);
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: huangzhiquan497/Fishing
    // 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); };
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: huangzhiquan497/Fishing
    /// <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));
        }
    }
コード例 #4
0
ファイル: Gun.cs プロジェクト: minh3d/Fish
    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;
    }
コード例 #5
0
ファイル: Player.cs プロジェクト: huangzhiquan497/Fishing
    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);
        }
    }
コード例 #6
0
    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);
    }
コード例 #7
0
ファイル: Player.cs プロジェクト: huangzhiquan497/Fishing
 /// <summary>
 /// 押分改变(自身触发)
 /// </summary>
 /// <param name="curScore"></param>
 void On_GunLevelTypeChanged(GunLevelType curType)
 {
     ChangeGun(curType, GunInst.GetPowerType());
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: huangzhiquan497/Fishing
 public bool ChangeGun(GunLevelType lvType, GunPowerType pwrType)
 {
     return(ChangeGun(Gun.CombineGunLevelAndPower(lvType, pwrType)));
 }
コード例 #9
0
ファイル: Player.cs プロジェクト: minh3d/Fish
 public bool ChangeGun(GunLevelType lvType, GunPowerType pwrType)
 {
     return ChangeGun(Gun.CombineGunLevelAndPower(lvType, pwrType));
 }
コード例 #10
0
ファイル: Player.cs プロジェクト: minh3d/Fish
 /// <summary>
 /// Ѻ�ָı�(�������)
 /// </summary>
 /// <param name="curScore"></param>
 void On_GunLevelTypeChanged(GunLevelType curType)
 {
     ChangeGun(curType, GunInst.GetPowerType());
 }