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 _initRippleBackground() { mRippleBackgroundStillSprite = _loadRippleStillSprite(); mRippleBackgroundStillSprite.setPosition(new EbVector3(-mScene.getSceneLength() / 2, -mScene.getSceneWidth() / 2, 0)); mRippleBackgroundStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Wave)); mRippleBackgroundStillSprite.setActive(false); }
//------------------------------------------------------------------------- public void freeBackgroundStillSprite(StillSprite still_sprite) { if (still_sprite == null) return; //Resources.UnloadAsset(still_sprite.renderer.material.mainTexture); still_sprite.destroy(); //Resources.UnloadUnusedAssets(); }
//------------------------------------------------------------------------- public virtual void destroy() { if (mSprite != null) { mScene.getRenderObjectPool().freeStillSprite(mSprite); mSprite = null; } }
public SpriteBox(StillSprite sprite, bool horizontal_scale, bool vertical_scale, float width, float height) { mStillSprite = sprite; mHorizontalScale = horizontal_scale; mVerticalScale = vertical_scale; mFixedWidth = width; mFixedHeight = height; }
//------------------------------------------------------------------------- void _freeShockBackground() { if (mShockBackgroundStillSprite == null) { return; } mBackgroundLoader.freeBackgroundStillSprite(mShockBackgroundStillSprite); mShockBackgroundStillSprite = null; }
public void destroy() { destroyRectangle(); mScene.getRenderObjectPool().freeStillSprite(mArrow); mScene.getRenderObjectPool().freeStillSprite(mNumber); mArrow = null; mNumber = null; }
//------------------------------------------------------------------------- public void destroy() { mLevelScreenShocker.destroy(); mLevelBackgroundMgr.destroy(); mLevelSeaStarMgr.destroy(); if (mRippleBackgroundStillSprite == null) return; mRippleBackgroundStillSprite.destroy(); mRippleBackgroundStillSprite = null; }
//------------------------------------------------------------------------- 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()); }
StillSprite _newStillSprite() { StillSprite still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.playAnimation("Fishnet11"); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSpriteFishNet"; #endif return(still_sprite); }
//------------------------------------------------------------------------- public override void destroy() { if (mHasDestroy) return; mHasDestroy = true; if (mCSpriteFishNet != null) { mCSpriteFishNet.destroy(); } mScene.getRenderObjectPool().freeStillSprite(mStillSprite); mStillSprite = null; mCSpriteFishNet = null; }
//------------------------------------------------------------------------- public void freeStillSprite(StillSprite still_sprite) { #if UNITY_EDITOR if (still_sprite != null && still_sprite.GetType().ToString() == "FishStillSprite") { EbLog.Error("freeStillSprite::error"); } #endif mStillSpritePool.freeStillSprite(still_sprite); }
//------------------------------------------------------------------------- public void freeBackgroundStillSprite(StillSprite still_sprite) { if (still_sprite == null) { return; } //Resources.UnloadAsset(still_sprite.renderer.material.mainTexture); still_sprite.destroy(); //Resources.UnloadUnusedAssets(); }
//------------------------------------------------------------------------- bool notInList(StillSprite fish, List <FishStillSprite> fish_list) { foreach (var it in fish_list) { if (it == fish) { return(false); } } return(true); }
//------------------------------------------------------------------------- void _newShockBackground(string background_name) { mShockBackgroundStillSprite = mBackgroundLoader.newBackgroundStillSprite(background_name, mScene); mShockBackgroundStillSprite.setPosition(EbVector3.Zero); mShockBackgroundStillSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.ShockBackground)); mShockBackgroundStillSprite.setActive(false); #if UNITY_EDITOR mShockBackgroundStillSprite.gameObject.name = "TkBackground"; #endif }
//------------------------------------------------------------------------- public void load(string prefab_name, _eLevelLayer layer) { mBgSprite = mBackgroundLoader.newBackgroundStillSprite(prefab_name, mScene); mBgSprite.setPosition(EbVector3.Zero); mBgSprite.setDirection(0); mBgSprite.setLayer(mScene.getLayerAlloter().getLayer(layer)); mBgClippedSprite = mBgSprite.gameObject.GetComponent <tk2dClippedSprite>(); #if UNITY_EDITOR mBgSprite.gameObject.name = "TkBackground"; #endif }
//------------------------------------------------------------------------- public void destroy() { mLevelScreenShocker.destroy(); mLevelBackgroundMgr.destroy(); mLevelSeaStarMgr.destroy(); if (mRippleBackgroundStillSprite == null) { return; } mRippleBackgroundStillSprite.destroy(); mRippleBackgroundStillSprite = null; }
//------------------------------------------------------------------------- public void destroy() { endGlow(); mScene.getRenderObjectPool().freeStillSprite(mTurretBaseSprite); mScene.getRenderObjectPool().freeStillSprite(mTurretTopSprite); mScene.getRenderObjectPool().freeStillSprite(mTurretBlazeSprite); mScene.getRenderObjectPool().freeStillSprite(mTurretBarrelSprite); mTurretBaseSprite = null; mTurretTopSprite = null; mTurretBlazeSprite = null; mTurretBarrelSprite = null; }
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 override void destroy() { if (mHasDestroy) { return; } mHasDestroy = true; if (mCSpriteFishNet != null) { mCSpriteFishNet.destroy(); } mScene.getRenderObjectPool().freeStillSprite(mStillSprite); mStillSprite = null; mCSpriteFishNet = null; }
//------------------------------------------------------------------------- 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); }
//------------------------------------------------------------------------- StillSprite _loadRippleStillSprite() { UnityEngine.Object prefab_object = Resources.Load("Game/Background/water_ani_movePrefab"); GameObject game_object = GameObject.Instantiate(prefab_object) as GameObject; StillSprite still_sprite = game_object.GetComponent <StillSprite>(); still_sprite.init(mScene); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSprite_Water_Wave"; mTKGameObject = GameObject.Find("TKGameObject"); still_sprite.transform.parent = mTKGameObject.transform; //still_sprite.transform.localScale = new Vector3(2.34f, 2.34f, 1); #endif return(still_sprite); }
//------------------------------------------------------------------------- public void create(CRenderScene scene, CRenderBullet render_bullet, string animation_name, TbDataParticle hit_particle) { mScene = scene; mBullet = render_bullet; mHitParticle = hit_particle; mStillSprite = mScene.getRenderObjectPool().newStillSprite(); mStillSprite.setTrigger(true); mStillSprite.playAnimation(animation_name); mStillSprite.onTriggerEnter += OnTriggerEnter; #if UNITY_EDITOR mStillSprite.gameObject.name = "TkSpriteBullet_" + animation_name; #endif mBoxY = mStillSprite.getBoxColliderSize().y; }
public void load(float elapsed_tm) { if (mLoaded) { return; } for (int i = 0; i < 3 * mLoadCountPerSecond; i++) { StillSprite still_sprite = newStillSprite(); mListPreloadStillSprite.Add(still_sprite); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSprite_Loading"; #endif } for (int i = 0; i < 1 * mLoadCountPerSecond; i++) { FishStillSprite fish_still_sprite = newFishStillSprite(); mListPreloadFishStillSprite.Add(fish_still_sprite); #if UNITY_EDITOR fish_still_sprite.gameObject.name = "TkFish_Loading"; #endif } mProgress = (float)mListPreloadFishStillSprite.Count / (float)mPreLoadCount; if (mListPreloadFishStillSprite.Count >= mPreLoadCount) { foreach (var it in mListPreloadStillSprite) { freeStillSprite(it); } mListPreloadStillSprite.Clear(); foreach (var it in mListPreloadFishStillSprite) { freeFishStillSprite(it); } mListPreloadFishStillSprite.Clear(); mProgress = 1; mLoaded = true; } }
//------------------------------------------------------------------------- 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 }
//------------------------------------------------------------------------- public override StillSprite newDigitSprite(int digit) { if (digit < 0) { digit = 0; } if (digit > 9) { digit = 9; } StillSprite still_sprite = mScene.getRenderObjectPool().newStillSprite(); still_sprite.playAnimation("digit_panel_" + digit); #if UNITY_EDITOR still_sprite.gameObject.name = "TkSpritePanelDigit_" + digit; #endif return(still_sprite); }
//------------------------------------------------------------------------- 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 abstract void freeDigitSprite(StillSprite digit_sprite);
//------------------------------------------------------------------------- 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 }
//------------------------------------------------------------------------- public override void freeDigitSprite(StillSprite digit_sprite) { mScene.getRenderObjectPool().freeStillSprite(digit_sprite); }
//------------------------------------------------------------------------- public void load(string prefab_name, _eLevelLayer layer) { mBgSprite = mBackgroundLoader.newBackgroundStillSprite(prefab_name, mScene); mBgSprite.setPosition(EbVector3.Zero); mBgSprite.setDirection(0); mBgSprite.setLayer(mScene.getLayerAlloter().getLayer(layer)); mBgClippedSprite = mBgSprite.gameObject.GetComponent<tk2dClippedSprite>(); #if UNITY_EDITOR mBgSprite.gameObject.name = "TkBackground"; #endif }
public SpriteAndOffset(StillSprite sprite, EbVector3 offset) { mStillSprite = sprite; mOffset = offset; }
//------------------------------------------------------------------------- public void destroy() { mBackgroundLoader.freeBackgroundStillSprite(mBgSprite); mBgSprite = null; mBgClippedSprite = null; }
//------------------------------------------------------------------------- void _freeShockBackground() { if (mShockBackgroundStillSprite == null) return; mBackgroundLoader.freeBackgroundStillSprite(mShockBackgroundStillSprite); mShockBackgroundStillSprite = null; }
//------------------------------------------------------------------------- bool notInList(StillSprite fish, List<FishStillSprite> fish_list) { foreach (var it in fish_list) { if (it == fish) return false; } return true; }