예제 #1
0
        //---------------------------------------------------------------------
        public void update(float elapsed_tm)
        {
            mLifeCounter -= elapsed_tm;
            if (mLifeCounter < 0)
            {
                CLogicTurret turret = mScene.getTurret(mPlayerId);
                if (turret != null)
                {
                    turret.removeBullet(mBulletObjId);
                }
                return;
            }

            // 不是机器人则直接返回
            if (mBulletCollider == null)
            {
                return;
            }

            CLogicFish fish = getLockFish();

            if (fish == null || fish.IsDie)
            {
                EbVector3 cur_pos = CLogicUtility.getCurrentPos(mPos, mfAngle, mfBulletSpeed, elapsed_tm);
                mPos = cur_pos;
                mBulletCollider.setPosition(mPos);
            }
            else
            {
                mfAngle = CLogicUtility.getAngle(fish.Position - mPos);
                mPos    = CLogicUtility.getCurrentPos(mPos, mfAngle, mfBulletSpeed, elapsed_tm);
                mBulletCollider.setPosition(mPos);
                mBulletCollider.setDirection(mfAngle);
            }

            if (mScene.getSceneBox().check(ref mPos, ref mfAngle))
            {
                mLockedFishObjid = -1;
                mBulletCollider.setPosition(mPos);
                mBulletCollider.setDirection(mfAngle);
            }
        }