Beispiel #1
0
        public void Update(float delta)
        {
            // -------------------------------------
            if (Input.GetMouseButtonDown(0) && SceneRuntime.HandleClickEvent == false && m_bAutoLocked)
            {
                ushort fishid = SceneRuntime.FishMgr.GetFishIDByScreenPoint(Input.mousePosition);
                //m_bAutoLocked = fishid != 0;
                m_LockedFishID = fishid;
            }
            // -------------------------------------
            if (m_LockedFishID != 0)
            {
                Vector3 startScrPoint  = SceneRuntime.GetLauncherScrStartPos(MyClientSeat);
                Vector3 startViewPoint = SceneRuntime.GetLauncherViewStartPos(MyClientSeat);
                Fish    fish           = SceneRuntime.FishMgr.FindFishByID(m_LockedFishID);

                if (fish == null || fish.IsDelay || fish.Catched || Utility.IsInScreen(fish.ScreenPos) == false ||
                    BuYuUtils.CheckLauncherAngle(fish, startScrPoint, startViewPoint) == false)
                {
                    m_LockedFishID = 0;
                }
            }
            else if (m_bAutoLocked)
            {
                //if(Utility.GetTickCount() - m_LockInterval > 0)
                {
                    Vector3 startScrPoint  = SceneRuntime.GetLauncherScrStartPos(MyClientSeat);
                    Vector3 startViewPoint = SceneRuntime.GetLauncherViewStartPos(MyClientSeat);
                    m_LockInterval = Utility.GetTickCount();
                    m_LockedFishID = SceneRuntime.FishMgr.GetFishBySortGold(startScrPoint, startViewPoint);
                }
            }

            //SceneRuntime.LogicUI.UpdateLockedUI();

            for (int i = 0; i < ConstValue.PLAYER_MAX_NUM; ++i)
            {
                if (m_PlayerList[i] == null)
                {
                    continue;
                }
                ScenePlayer sp = m_PlayerList[i];
                sp.Launcher.Update(delta);
                if (sp.ComboEft != null && sp.ComboEft.m_BaseWndObject != null)
                {
                    if (sp.ComboEft.m_BaseWndObject.activeSelf != true)
                    {
                        continue;
                    }
                    if (sp.ComboEft.Updata(delta) == false)
                    {
                        sp.ComboEft.m_BaseWndObject.SetActive(false);
                    }
                }
            }
        }
Beispiel #2
0
        public void LaunchFish(NetCmdPack pack)
        {
            NetCmdFish    cmdFish     = (NetCmdFish)pack.cmd;
            GroupDataList gdl         = FishResManager.Instance.GetFishGroup(cmdFish.GroupID);
            ushort        startID     = cmdFish.StartID;
            float         elapsedTime = Utility.TickSpan(pack.tick) + SceneRuntime.NetDelayTime;

            if (gdl.PathGroupData != null)
            {
                FishPathGroupData        pathgroup  = gdl.PathGroupData;
                PathLinearInterpolator[] interpList = PathManager.Instance.GetPathGroup(pathgroup.PathGroupIndex, SceneRuntime.Inversion);
                foreach (PathLinearInterpolator interp in interpList)
                {
                    Fish fish = new Fish();
                    fish.Init(startID, pathgroup.FishIndex, pathgroup.FishScaling, 0, pathgroup.ActionSpeed, pathgroup.ActionUnite, pathgroup.Speed, interp);
#if UNITY_EDITOR
                    fish.SetModelName("Fish_PathGroup_" + cmdFish.GroupID);
#endif
                    if (fish.AddElapsedTime(elapsedTime))
                    {
                        SetFish(fish);
                    }
                    else
                    {
                        fish.Destroy();
                    }

                    if (++startID >= FishSetting.FISH_MAX_NUM)
                    {
                        startID = 0;
                    }
                }
            }
            else
            {
                float fInv                = SceneRuntime.Inversion ? -1.0f : 1.0f;
                int   pathIndex           = cmdFish.PathID;
                PathLinearInterpolator pi = PathManager.Instance.GetPath(pathIndex, SceneRuntime.Inversion);
                float startX              = gdl.FrontPosition.x;
                foreach (GroupData gd in gdl.GroupDataArray)
                {
                    if (gd == null)
                    {
                        break;
                    }
                    if (gd.FishNum > gd.PosList.Length)
                    {
                        LogMgr.Log("错误的鱼群路径点:" + gd.FishNum + ", posnum:" + gd.PosList.Length);
                        return;
                    }
                    for (int i = 0; i < gd.FishNum; ++i)
                    {
                        float time = BuYuUtils.GetPathTimeByDist(startX, gd.PosList[i].x, pi);
                        Fish  fish = new Fish();
                        fish.Init(startID, gd.FishIndex, gd.FishScaling, time, gd.ActionSpeed, gd.ActionUnite, gd.SpeedScaling, pi);
#if UNITY_EDITOR
                        fish.SetModelName("Fish_FishGroup_" + cmdFish.GroupID + "_Path_" + pathIndex);
#endif
                        if (fish.AddElapsedTime(elapsedTime))
                        {
                            fish.SetOffset(new Vector3(0, fInv * gd.PosList[i].y, gd.PosList[i].z));
                            SetFish(fish);
                        }
                        else
                        {
                            fish.Destroy();
                        }
                        if (++startID == FishSetting.FISH_MAX_NUM)
                        {
                            startID = 0;
                        }
                    }
                }
            }
        }