Пример #1
0
    public override bool Update(float delta, Fish fish, out bool bRemove)
    {
        float x = Camera.main.WorldToScreenPoint(fish.Position).x;

        if (m_LeftToRight)
        {
            x /= Screen.width;
        }
        else
        {
            x = (Screen.width - x) / Screen.width;
        }

        float delay = x * 1.5f + 1.1f;

        if (delay <= m_Timer.LifeTime || m_Timer.IsEnd)
        {
            fish.StopLaugh(false);
            if (fish.ExtraData != null)
            {
                GlobalEffectData gfd = (GlobalEffectData)fish.ExtraData;
                fish.ExtraData = null;
                gfd.Life       = 0;
            }
            float transRot = -Utility.Range(100, 200);
            float pathRot  = -Utility.Range(300, 500);
            float speed    = Utility.Range(15, 20) * SceneRuntime.ComputeZScaling(fish, 1.0f);

            FishOptPath fop = new FishOptPath(PathManager.Instance.BoLang, transRot, pathRot, speed, 0, fish.Position, true);
            fop.SetDeadData(0, false, null);
            fish.AddOpt(fop);
            bRemove = true;
        }
        else
        {
            bRemove = false;
        }
        return(true);
    }