public LinkLockedFishFeature(CRenderScene scene, CRenderTurret turret) { mCRenderTurret = turret; mScene = scene; mLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.LinkLockedFish); mArrow = mScene.getRenderObjectPool().newStillSprite(); mArrow.setScale(0.5f); mArrow.playAnimation("locking_line_array"); mArrow.setColor(mCRenderTurret.getTurretColor()); mArrow.setLayer(mLayer); mNumber = mScene.getRenderObjectPool().newStillSprite(); mNumber.setScale(1f); mNumber.playAnimation("locking_line_target_" + mCRenderTurret.getTurretId()); mNumber.setColor(mCRenderTurret.getTurretColor()); mNumber.setLayer(mLayer); setActive(false); #if UNITY_EDITOR mArrow.gameObject.name = "TkSpriteLinkLocked_locking_line_array"; mNumber.gameObject.name = "TkSpriteLinkLocked_locking_line_target_" + mCRenderTurret.getTurretId(); #endif }
//------------------------------------------------------------------------- void _initCSprite(string name, string tag) { if (mAnimationName == "") { return; } mSprite = mScene.getRenderObjectPool().newStillSprite(); mSprite.setTag(tag); mSprite.playAnimation(mAnimationName); mSprite.setScale(1f); mSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Buffer)); //if (name == "BufLock") //{ // mSprite.setScale(0.47f); //} //else //{ // mSprite.setScale(0.38f * 2.7f); //} #if UNITY_EDITOR mSprite.gameObject.name = "TkSpriteBuffer_" + name; #endif }
//------------------------------------------------------------------------- void _initTurretUnit(ref StillSprite still_sprite, string animation_name, float scale, _eLevelLayer layer) { still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.playAnimation(animation_name); still_sprite.setScale(scale); still_sprite.setLayer(mScene.getLayerAlloter().getLayer(layer)); still_sprite.setPosition(mRenderTurret.getTurretPos()); still_sprite.setDirection(mScene.getTurretHelper().getBaseAngleByTurretId(mRenderTurret.getTurretId())); still_sprite.setTag("CSpriteTurret" + mRenderTurret.getTurretId()); }
//------------------------------------------------------------------------- public void setScale(float x_scale, float y_scale, float fixed_scale, SpriteBox center_box) { if (mHorizontalScale && mVerticalScale) { mStillSprite.setScale(x_scale, y_scale); } else if (mHorizontalScale) { mStillSprite.setScale(x_scale, fixed_scale); } else if (mVerticalScale) { mStillSprite.setScale(fixed_scale, y_scale); } if (this != center_box) { mOffset = calPosition(this, center_box); } else { } }
void newRectangleSprite() { StillSprite sprite = mScene.getRenderObjectPool().newStillSprite(); sprite.playAnimation("locking_line_rectangle"); sprite.setColor(mCRenderTurret.getTurretColor()); sprite.setScale(0.5f); sprite.setLayer(mLayer); mRectangle.Add(sprite); #if UNITY_EDITOR sprite.gameObject.name = "TkSpriteLinkLocked_locking_line_rectangle"; #endif }
//------------------------------------------------------------------------- public LevelBackgroundMgr(CRenderScene scene, CSpriteBackgroundLoader loader) { mScene = scene; mBackgroundLoader = loader; mSpeed = 960f / mMaxTime; mWaveStillSprite = mScene.getRenderObjectPool().newStillSprite(); mWaveStillSprite.playAnimation("WaterWave"); mWaveStillSprite.setActive(false); mWaveStillSprite.setScale(700f / 550f); #if UNITY_EDITOR mWaveStillSprite.gameObject.name = "TkSpriteWaterWave"; #endif }
void _newChip() { StillSprite still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.playAnimation("chip"); still_sprite.setScale(mScene.getRenderConfigure().ChipSacle); still_sprite.setLayer(mHeapLayer); mStackChips.Add(still_sprite); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSpriteChips_chip"; #endif _updateChipsView(mHeapScruct.Position, mHeapScruct.UpAngle); }
//------------------------------------------------------------------------- public CSpriteScore(CRenderScene scene, EbVector3 position, float angle, int turret_no) { mScene = scene; mSpriteNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene)); mSpriteNumber.create(0, position, angle, CSpriteNumber._eNumberSize.Small1, CSpriteNumber._eNumberAlign.Right); mSpriteNumber.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore)); mBackground = mScene.getRenderObjectPool().newStillSprite(); mBackground.playAnimation("score_panel_" + turret_no); mBackground.setScale(1, 1f); setScore(0); #if UNITY_EDITOR mBackground.gameObject.name = "TkSpriteSpriteScore_score_panel_" + turret_no; #endif }
//------------------------------------------------------------------------- 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 CSpriteBgNumber(CRenderScene scene, BgColorEnum color, int number) { mScene = scene; float number_layer = mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore); mCSpriteNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene)); mCSpriteNumber.create(number, EbVector3.Zero, 0, CSpriteNumber._eNumberSize.Small2); mCSpriteNumber.setLayer(number_layer); mNumberBackgroundCSprite = mScene.getRenderObjectPool().newStillSprite(); mNumberBackgroundCSprite.setLayer(number_layer + mScene.getLayerAlloter().EachFishGap / 100f); mNumberBackgroundCSprite.setScale(0.65f * number.ToString().Length, 0.8f); mNumberBackgroundCSprite.playAnimation(getAnimationNameByColor(color)); #if UNITY_EDITOR mNumberBackgroundCSprite.gameObject.name = "TkSpriteChips_" + getAnimationNameByColor(color); #endif }
//------------------------------------------------------------------------- void buildFrame(string pic_name, float scale, int vib_id) { mPicName = pic_name; vmVibId = vib_id; if ((vib_id == 1 || vib_id == 2 || vib_id == 3 || vib_id == 4) && mMapParam.ContainsKey("NetColor")) { mAnimationName = pic_name; mCSpriteFishNet = new CSpriteFishNet(); Color color = (Color)mMapParam["NetColor"]; uint et_player_rpcid = (uint)mMapParam["PlayerId"]; mCSpriteFishNet.create(color, et_player_rpcid, (CRenderFish)mMapParam["BulletHitFish"], mScene, mAnimationName); mCSpriteFishNet.setScale(scale); } else { mStillSprite = mScene.getRenderObjectPool().newStillSprite(); mStillSprite.setScale(scale); mStillSprite.playAnimation(pic_name); #if UNITY_EDITOR mStillSprite.gameObject.name = "TkSpriteEffectFrameAnimation_" + pic_name; #endif } EbVector3 v2 = (EbVector3)mMapParam["SourcePosition"]; if (mCSpriteFishNet != null) { mCSpriteFishNet.setPosition(v2, 0); mCSpriteFishNet.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishNet)); } if (mStillSprite != null) { mStillSprite.setPosition(v2); mStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishNet)); } }
//------------------------------------------------------------------------- public void setScale(float scale) { mStillSprite.setScale(scale); }