Пример #1
0
    //-------------------------------------------------------------------------
    public void setDirection(float angle)
    {
        EbVector3 vec       = CLogicUtility.getDirection(angle);
        Vector3   direction = new Vector3(vec.x, vec.y, 0);

        mTransform.localRotation = Quaternion.FromToRotation(Vector3.up, direction);
    }
Пример #2
0
 void _updateView()
 {
     foreach (var it in mSprite)
     {
         it.mFishStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale * mFixedScale, mAngle));
     }
 }
Пример #3
0
    //-------------------------------------------------------------------------
    public void update(float elapsed_tm)
    {
        if (!mIsShockingScreen)
        {
            return;
        }
        mSecondsSinceSwitchBackground += elapsed_tm;

        EbVector3 background_new_position = EbVector3.Zero;

        if (_isInFirstFrame())
        {
            background_new_position = CLogicUtility.getDirection(mShakeAngle) * mFirstFrameTimeDistance;
        }
        else if (_isInSecondFrame())
        {
            background_new_position = CLogicUtility.getDirection(mShakeAngle) * mSecondFrameTimeDistance;
        }
        else if (_isInInitFrame())
        {
            mSecondsSinceSwitchBackground = 0;
        }

        mShockBackgroundStillSprite.setPosition(background_new_position);
    }
Пример #4
0
    //-------------------------------------------------------------------------
    void _updateDigitsLayout()
    {
        float offset = 0f;

        switch (mNumberInfo.Align)
        {
        case _eNumberAlign.Left:
            offset = 0.5f;
            break;

        case _eNumberAlign.Right:
            offset = mNumberInfo.DigitCount + 0.5f;
            break;

        default:
            if (_isOdd(mNumberInfo.DigitCount))
            {
                offset = (int)(((float)mNumberInfo.DigitCount - 1f) / 2f);
            }
            else
            {
                offset = mNumberInfo.DigitCount / 2 - 0.5f;
            }
            break;
        }

        for (int i = mNumberInfo.DigitCount - 1; i >= 0; i--)
        {
            mListDigit[i].setPosition(mNumberInfo.Position + CLogicUtility.getDirection(mNumberInfo.UpAngle + 90) * (mNumberInfo.DigitCount - 1 - i - offset) * mNumberInfo.DigitGap);
            mListDigit[i].setDirection(mNumberInfo.UpAngle);
        }
    }
Пример #5
0
 void _updateView()
 {
     foreach (var it in mStillSpriteList)
     {
         it.mStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale, mAngle));
         it.mStillSprite.setDirection(mAngle);
     }
 }
Пример #6
0
 //-------------------------------------------------------------------------
 void _updateView()
 {
     foreach (var it in mStillSprites)
     {
         EbVector3 offset = new EbVector3(it.mOffset.x * mXScale, it.mOffset.y * mYScale, 0);
         it.mStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(offset, mAngle));
         it.mStillSprite.setDirection(mAngle);
     }
 }
Пример #7
0
    //-------------------------------------------------------------------------
    public void setPosition(EbVector3 pos)
    {
        EbVector3 pixel_pos = CCoordinate.logic2toolkitPos(pos);

        pixel_pos += CLogicUtility.getVector2ByRotateAngle(mOffsetLocation, mDirection);

        Vector3 cur_pos;

        cur_pos.x           = pixel_pos.x;
        cur_pos.y           = pixel_pos.y;
        cur_pos.z           = mTransform.position.z;
        mTransform.position = cur_pos;
    }
Пример #8
0
    //-------------------------------------------------------------------------
    public CSpriteCounter(CRenderScene scene, EbVector3 origin_position, float up_angle)
    {
        mScene = scene;

        mCounterScruct.MovingSpeed     = 100f;
        mCounterScruct.OriginPosition  = origin_position;
        mCounterScruct.UpAngle         = up_angle;
        mCounterScruct.GapBetweenHeaps = mScene.getRenderConfigure().ChipHSpace;
        mCounterScruct.RightAngle      = CLogicUtility.getRightAngle(up_angle);
        mCounterScruct.RightDistance   = CLogicUtility.getDirection(mCounterScruct.RightAngle) * mCounterScruct.GapBetweenHeaps;
        mCounterState     = _eCounterState.Adding;
        mCSpriteHeapGroup = new CSpriteHeapGroup(4);

        mScoreCounterMap.create(mScene.getRenderConfigure().ScoreGap);
    }
Пример #9
0
    //-------------------------------------------------------------------------
    void _updateChipsView(EbVector3 position, float up_angle)
    {
        float chip_gap           = mScene.getRenderConfigure().ChipVSpace;
        float chip_number_offset = mScene.getRenderConfigure().ChipNumberOffset;

        EbVector3 new_position = EbVector3.Zero;

        int index = 0;

        foreach (var it in mStackChips)
        {
            new_position  = position;
            new_position += CLogicUtility.getDirection(up_angle) * (chip_gap * index++);
            it.setPosition(new_position);
            it.setDirection(up_angle);
        }

        new_position += CLogicUtility.getDirection(up_angle) * chip_number_offset;
        mCSpriteBgNumber.setPosition(new_position, up_angle);
    }
Пример #10
0
    //-------------------------------------------------------------------------
    public void switchBackground(string prefab_name, float already_update_time)
    {
        if (mBgMgr == null)
        {
            _loadBgSprite(prefab_name);
            if (onLoadMapEnd != null)
            {
                onLoadMapEnd();
            }
        }
        else
        {
            if (mIsSwitching)
            {
                if (!mHasEarlyClean)
                {
                    mScene.getLevel().clearAllFish();
                }
                switchBackgroundPic();
                mWaveStillSprite.setActive(false);
                mIsSwitching = false;
            }
            mAlreadyUpdateTime = already_update_time;
            mBgMgr.mBgClippedSprite.ClipRect = new Rect(1, 0, 1, 1);
            _loadFgSprite(prefab_name);

            mMassEntity = new MassEntity();
            mMassEntity.setSpeed(mSpeed);
            mMassEntity.setRoute(RouteHelper.buildLineRoute(new EbVector3(650, 0, 0), CLogicUtility.getDirection(-90), 2000));
            mWaveStillSprite.setActive(true);
            mWaveStillSprite.setDirection(-90);
            mWaveStillSprite.setPosition(new EbVector3(650, 0, 0));
            mWaveStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Ripple));

            mIsSwitching   = true;
            mHasEarlyClean = false;
        }
    }
Пример #11
0
 //-------------------------------------------------------------------------
 float getHitAngle(EbVector3 fish_pos, EbVector3 bullet_pos)
 {
     return(CLogicUtility.getAngle(fish_pos - bullet_pos));
 }