Example #1
0
    public void LaunchLaser(byte clientSeat, short degree)
    {
        if (m_bMyself)
        {
            m_bLauncherXPSkill = false;
            ClearXPSkillEft();
            m_EnergyPoolLogic[LauncherType].LaserCDState = true;
            m_EnergyPoolLogic[LauncherType].Rollback     = true;
            m_EnergyPoolLogic[LauncherType].PlayRollbackPoolUI(1000);
            m_EnergyPoolUI.fillAmount = m_EnergyPoolLogic[LauncherType].FillAmount;
        }

        Vector3 startPos;
        Vector3 dir;

        degree = SceneRuntime.AngleInversion(degree);
        SceneRuntime.GetBulletPosAndDir(clientSeat, degree, out dir, out startPos);
        if (!m_bMyself)
        {
            Vector2 direction = new Vector2(dir.x, dir.y);
            Direction = direction;
            UpdatOtherAngle();
        }
        SceneRuntime.LauncherEftMgr.PlayXPSkillMuzzleEft(m_GunBarrel.BaseTransform, LauncherType, startPos, m_LauncherSetting.LaserCDTime);
        SceneRuntime.LauncherEftMgr.PlayLaserEft(m_GunBarrel.BaseTransform, LauncherType, clientSeat, Direction, startPos, m_Angle);
        // SceneRuntime.LauncherEftMgr.RemoveAtEffect();
    }
Example #2
0
    public void LaunchBullet(ushort bulletID, byte launcherType, byte rateIndex, short angle, float time, byte reboundCount, ushort lockfishid /*, byte collidCount = 0, float pauseTime = 0, float speedScaling = 0*/)
    {
        byte clientSeat, id;

        SceneRuntime.BuuletIDToSeat(bulletID, out clientSeat, out id);
        Bullet  bullet = new Bullet();
        Vector3 startpos;
        Vector3 dir;
        float   volume  = 1;
        float   curtime = Time.time;

        byte[] type = { 9, 9, 10, 11, 12 };
        if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
        {
            return;
        }

        if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == SceneRuntime.PlayerMgr.MySelf)
        {
            volume   = 1;
            lastTime = curtime;
            GlobalAudioMgr.Instance.PlayOrdianryMusic((Audio.OrdianryMusic)type[launcherType], false, false, volume);
        }
        else
        {
            volume = 0.30f;
            if ((lastTime + 0.1f) < curtime)
            {
                GlobalAudioMgr.Instance.PlayOrdianryMusic((Audio.OrdianryMusic)type[launcherType], false, false, volume);
            }
        }

        SceneRuntime.GetBulletPosAndDir(clientSeat, angle, out dir, out startpos);
        SceneRuntime.PlayerMgr.ChangeLauncherAngle(dir, clientSeat);        //改变炮台角度
        bullet.Init(clientSeat, id, launcherType, rateIndex, startpos, dir, reboundCount, lockfishid);
        bullet.InitAngle(Utility.ShortToFlaot(angle));
        //bullet.SetCollidData(collidCount, pauseTime, speedScaling);
        PlayerBullets pb = m_PlayerBullets[clientSeat];

        if (pb != null)
        {
            Bullet findBullet;
            if (pb.BulletList.TryGetValue(id, out findBullet))
            {
                Debug.Log("相同的子弹ID:" + id);
                findBullet.Destroy();
                pb.BulletList.Remove(id);
            }
            if (time > 0)
            {
                bullet.Update(time);
            }
            pb.BulletList.Add(id, bullet);
        }
    }
Example #3
0
    public static void Init(SceneLogic logic)
    {
        Instance       = new SceneRuntime();
        Instance.Scene = logic;

        float LAUNCHER_X       = 15.5f;
        float LAUNCHER_X_RIGHT = 10.5f;
        float LAUNCHER_Y       = 11.5f;

        //子弹的位置
        //		3	2
        //		0,	1
        float height          = ConstValue.NEAR_HALF_HEIGHT;
        BulletStartPosData pd = new BulletStartPosData();

        pd.Center = new Vector3(-LAUNCHER_X, -height, 0);
        pd.Pos    = new Vector3(-LAUNCHER_X, -LAUNCHER_Y, 0);
        pd.Dir    = pd.Pos - pd.Center;
        pd.Length = pd.Dir.magnitude;
        pd.Dir   /= pd.Length;
        Instance.m_BulletPosData[0] = pd;

        pd        = new BulletStartPosData();
        pd.Center = new Vector3(LAUNCHER_X_RIGHT, -height, 0);
        pd.Pos    = new Vector3(LAUNCHER_X_RIGHT, -LAUNCHER_Y, 0);
        pd.Dir    = pd.Pos - pd.Center;
        pd.Length = pd.Dir.magnitude;
        pd.Dir   /= pd.Length;
        Instance.m_BulletPosData[1] = pd;

        pd        = new BulletStartPosData();
        pd.Center = new Vector3(LAUNCHER_X_RIGHT, height, 0);
        pd.Pos    = new Vector3(LAUNCHER_X_RIGHT, LAUNCHER_Y, 0);
        pd.Dir    = pd.Pos - pd.Center;
        pd.Length = pd.Dir.magnitude;
        pd.Dir   /= pd.Length;
        Instance.m_BulletPosData[2] = pd;

        pd        = new BulletStartPosData();
        pd.Center = new Vector3(-LAUNCHER_X, height, 0);
        pd.Pos    = new Vector3(-LAUNCHER_X, LAUNCHER_Y, 0);
        pd.Dir    = pd.Pos - pd.Center;
        pd.Length = pd.Dir.magnitude;
        pd.Dir   /= pd.Length;
        Instance.m_BulletPosData[3] = pd;

        //炮台金币的位置
        Instance.GlodPosMapping[0] = new Vector3(-0.54270833f, -0.9461806f, 0.0f);
        Instance.GlodPosMapping[1] = new Vector3(0.938773155f, -0.9461806f, 0.0f);
        Instance.GlodPosMapping[2] = new Vector3(0.917939842f, 0.9458333f, 0.0f);
        Instance.GlodPosMapping[3] = new Vector3(-0.563541651f, 0.9458333f, 0.0f);
        Instance.GlodPosMapping[4] = new Vector3(-0.580940962f, -0.8208333f, 0.0f);
        Instance.GlodPosMapping[5] = new Vector3(0.902314842f, -0.8208333f, 0.0f);


        Vector3 dir1, dir2;

        SceneRuntime.GetBulletPosAndDir(0, 0, out dir1, out LauncherScrStartPos1);
        SceneRuntime.GetBulletPosAndDir(1, 0, out dir2, out LauncherScrStartPos2);
        LauncherScrStartPos1   = Camera.main.WorldToScreenPoint(LauncherScrStartPos1);
        LauncherScrStartPos2   = Camera.main.WorldToScreenPoint(LauncherScrStartPos2);
        LauncherScrStartPos1.z = 0;
        LauncherScrStartPos2.z = 0;

        LauncherViewStartPos1   = Camera.main.ScreenToViewportPoint(LauncherScrStartPos1);
        LauncherViewStartPos2   = Camera.main.ScreenToViewportPoint(LauncherScrStartPos2);
        LauncherViewStartPos1.z = 0;
        LauncherViewStartPos2.z = 0;
    }