//--------------------------------------------------------------------- EbVector3 trans2local(EbVector3 point) { EbVector3 local = point - mPosition; local = CLogicUtility.getVector2ByRotateAngle(local, -mAngle); return(local); }
void _updateView() { foreach (var it in mSprite) { it.mFishStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale * mFixedScale, mAngle)); } }
void _updateView() { foreach (var it in mStillSpriteList) { it.mStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale, mAngle)); it.mStillSprite.setDirection(mAngle); } }
//------------------------------------------------------------------------- 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); } }
//------------------------------------------------------------------------- void _updateBufferPosition() { EbVector3 right_direction = CLogicUtility.getVector2ByRotateAngle(CLogicUtility.getDirection(mUpAngle), 90).normalized; int index = 0; foreach (var i in mMapBuffer) { i.Value.setPosition(mFisrtPoint + right_direction * index * mGap, mUpAngle); index++; } }
void _updateView() { foreach (var it in mFishs) { it.mFishStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale, mAngle)); it.mFishStillSprite.setDirection(mAngle); } foreach (var it in mBackground) { it.mFishStillSprite.setPosition(mPosition + CLogicUtility.getVector2ByRotateAngle(it.mOffset * mScale, mAngle)); } }
//------------------------------------------------------------------------- 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; }
//------------------------------------------------------------------------- void create(EbVector3 cur_pos) { string animation_name = ""; float scale_x = 1f; float scale_y = 1f; float width_x = 10f; float width_y = 60f; if (mScene.getLevel().getRandoNumber(0, 100) < 50) { animation_name = "lightening-yellow"; scale_y = width_y / 132f; width_x = 360f; } else { animation_name = "lightning-green"; scale_y = width_y / 85f; width_x = 420f; } foreach (var n in fish_list) { float distance = n.Position.getDistance(cur_pos); if (distance > 1100) { continue; } EbVector3 middle_pos = EbVector3.lerp(n.Position, cur_pos, 0.5f); StillSprite still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.setPosition(middle_pos); still_sprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishSwim)); still_sprite.setDirection(CLogicUtility.getAngle(CLogicUtility.getVector2ByRotateAngle(cur_pos - n.Position, 90))); still_sprite.setScale(n.Position.getDistance(cur_pos) / width_x, scale_y); still_sprite.playAnimation(animation_name); mListLight.Add(still_sprite); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSpriteEffectLighting_" + animation_name; #endif } }
//------------------------------------------------------------------------- public void update(float elapsed_tm) { mCurrentAngle += elapsed_tm * mAngleSpeed; EbVector3 right_direction = CLogicUtility.getVector2ByRotateAngle(CLogicUtility.getDirection(mUpAngle), 90).normalized; EbVector3 postion = mFisrtPoint + CLogicUtility.getDirection(mCurrentAngle) * mRadius; for (int i = 0; i < mMapBuffer.Count; i++) { var item = mMapBuffer.ElementAt(i); item.Value.update(elapsed_tm); item.Value.setPosition(postion + right_direction * i * mGap, mUpAngle); if (item.Value.canDestroy()) { item.Value.destroy(); mMapBuffer.Remove(item.Key); } } }
//----------------------------------------------------------------------------- public void next(float elapsed_tm, float speed) { if (mIsEndRoute) { return; } mTime += elapsed_tm; if (mTime >= mDuration) { mPosition = mInitPosition; mIsEndRoute = true; return; } float delta_y = _getCurveValue(mTime); mPosition = mInitPosition + CLogicUtility.getVector2ByRotateAngle(new EbVector3(0, delta_y, 0), mInitAngle); }
//------------------------------------------------------------------------- public EbVector3 getPositionByOffset(int turret_id, EbVector3 offset) { return(mBasePositions[turret_id] + CLogicUtility.getVector2ByRotateAngle(offset, mBaseAngles[turret_id])); }