Пример #1
0
 public void ResetItem()
 {
     isUsing = false;
     gameObject.SetActive(false);
     boxcollider.enabled = false;
     splineMove.ResetToStart();
     splineMove.speed = 0;
     splineMove.Stop();
     splineMove.enabled = false;
     transform.SetParent(MainPanel._Ins.foodCtrl.transform);
     foodInfo.FOODSTATE = FoodState.Free;
 }
Пример #2
0
    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);
        });
    }
Пример #3
0
    void MoveToEndOfPathManagerSegment()
    {
        if (_currentSplineMove)
        {
            _currentSplineMove.Stop();
            Destroy(_currentSplineMove);
        }

        _currentSplineMove = _oilVehicle.AddComponent <splineMove>();
        _currentSplineMove.pathContainer = _currentPathManagerEdge.PathManager;
        _currentSplineMove.pathMode      = DG.Tweening.PathMode.TopDown2D;
        _currentSplineMove.onStart       = true;
        _currentSplineMove.moveToPath    = false;
        _currentSplineMove.loopType      = splineMove.LoopType.none;
        _currentSplineMove.speed         = _currentSpeed;
        _currentSplineMove.easeType      = DG.Tweening.Ease.Linear;

        var startIndex = _currentPathManagerEdge.EntryWaypoint.transform.GetSiblingIndex();
        var endIndex   = _currentPathManagerEdge.ExitWaypoint.transform.GetSiblingIndex();

        if (reversed)
        {
            var temp = endIndex;
            endIndex   = startIndex;
            startIndex = temp;
        }
        _currentSplineMove.reverse = startIndex > endIndex;
        var bezierPathManager    = _currentPathManagerEdge.PathManager as BezierPathManager;
        var defaultPoints        = 10;
        var startIndexMultiplier = (bezierPathManager != null ? Mathf.CeilToInt(bezierPathManager.pathDetail * defaultPoints) : 1);

        _currentSplineMove.startPoint = startIndex * startIndexMultiplier + (bezierPathManager != null ? 0 : 0);

        _oilVehicle.transform.position = _currentPathManagerEdge.PathManager.waypoints[startIndex].transform.position;

        StartCoroutine(WaitForSplineInitialization());
    }