Пример #1
0
    //-------------------------------------------------------------------------
    public void update(float elapsed_tm)
    {
        _updateFireAnimation(elapsed_tm);
        mTurretBarrelSprite.setDirection(mRenderTurret.getTurretAngle());

        updateGlow(elapsed_tm);
    }
Пример #2
0
 //-------------------------------------------------------------------------
 public virtual void setPosition(EbVector3 position, float angle)
 {
     if (mSprite != null)
     {
         mSprite.setPosition(position);
         mSprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Buffer));
         mSprite.setDirection(angle);
     }
 }
Пример #3
0
 //-------------------------------------------------------------------------
 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());
 }
Пример #4
0
        //-------------------------------------------------------------------------
        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
        }
Пример #5
0
    //-------------------------------------------------------------------------
    void _playFireAnimation()
    {
        mMassEntity = new MassEntity();
        RouteParaCurve route = new RouteParaCurve();

        route.create(mRenderTurret.getTurretPos(), mRenderTurret.getTurretAngle(), 0.1f, -13f);
        mMassEntity.setRoute(route);
        mIsFireAnimation = true;
        mTurretBlazeSprite.setActive(true);
        mTurretBlazeSprite.setPosition(mRenderTurret.getTurretPos());
        mTurretBlazeSprite.setDirection(mRenderTurret.getTurretAngle());
    }
Пример #6
0
        void updateView(CRenderFish fish)
        {
            EbVector3 turret_position = mCRenderTurret.getTurretPos();
            EbVector3 fish_position   = fish.Position;

            float turret_fish_distance = turret_position.getDistance(fish_position);

            int rectangle_count = (int)(turret_fish_distance / mRectangleGap);

            if (rectangle_count < 0)
            {
                rectangle_count = 0;
            }
            if (mRectangle.Count > rectangle_count)
            {
                int remove_count = mRectangle.Count - rectangle_count;

                do
                {
                    mScene.getRenderObjectPool().freeStillSprite(mRectangle[0]);
                    mRectangle.RemoveAt(0);
                    --remove_count;
                } while (remove_count > 0);
            }
            else if (mRectangle.Count < rectangle_count)
            {
                int add_count = rectangle_count - mRectangle.Count;
                do
                {
                    newRectangleSprite();
                    --add_count;
                } while (add_count > 0);
            }


            float angle = CLogicUtility.getAngle(fish_position - turret_position);

            float node_count = mRectangle.Count + 2;

            for (int i = 0; i < mRectangle.Count; i++)
            {
                mRectangle[i].setPosition(EbVector3.lerp(turret_position, fish_position, ((float)i + 1) / node_count));
                mRectangle[i].setDirection(angle);
            }

            mArrow.setPosition(EbVector3.lerp(turret_position, fish_position, (node_count - 1) / node_count));
            mArrow.setDirection(angle);

            mNumber.setPosition(fish_position);
        }
Пример #7
0
        //-------------------------------------------------------------------------
        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
            }
        }
Пример #8
0
 //-------------------------------------------------------------------------
 public void setDirection(float angle)
 {
     mStillSprite.setDirection(angle);
 }
Пример #9
0
 //-------------------------------------------------------------------------
 public void setPosition(EbVector3 position, float angle)
 {
     mCSpriteNumber.setPosition(position, angle);
     mNumberBackgroundCSprite.setPosition(position);
     mNumberBackgroundCSprite.setDirection(angle);
 }
Пример #10
0
 //-------------------------------------------------------------------------
 public void setBgPosition(EbVector3 position, float up_angle)
 {
     mBackground.setPosition(position);
     mBackground.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScoreBg));
     mBackground.setDirection(up_angle);
 }