Inheritance: MonoBehaviour
Example #1
0
 public void ResetCameraEffects()
 {
     currentCameraEffect = CameraEffect.Normal;
     ((MonoBehaviour)MainCamera.GetComponent("Vignetting")).enabled = false;
     ((MonoBehaviour)MainCamera.GetComponent("Blur")).enabled       = false;
     MainCamera.GetComponent <MotionBlur>().enabled = false;
 }
Example #2
0
        public void SetCameraEffect(CameraEffect effect)
        {
            StorySceneCameraEffectMessage message = new StorySceneCameraEffectMessage();

            message.effect = effect;
            _connection.SendMessage(message);
        }
Example #3
0
 public void DoCameraPassOutEffect()
 {
     currentCameraEffect = CameraEffect.PassingOut;
     ((MonoBehaviour)MainCamera.GetComponent("Vignetting")).enabled = true;
     ((MonoBehaviour)MainCamera.GetComponent("Blur")).enabled       = true;
     MainCamera.GetComponent <MotionBlur>().enabled = true;
 }
Example #4
0
    // Start is called before the first frame update
    protected virtual void Start()
    {
        currentLaySec = maxLaySec;
        bloodPlace    = transform.Find("BloodPlace");
        if (bloodPlace == null)
        {
            Debug.LogWarning("blood spawn place of " + name + " can't be found");
        }
        cameraEffect         = Camera.main.GetComponent <CameraEffect>();
        HP                   = maxHp;
        rb                   = GetComponent <Rigidbody>();
        animator             = GetComponent <Animator>();
        originalExtraGravity = extraGravity;


        GameManager.Instance.gameObjects.Add(gameObject);

        if (spriteRenderer == null)
        {
            spriteRenderer = GetComponent <SpriteRenderer>();
        }
        ChangeEnemyState(EnemyState.Standing);

        nextAttackTime = 0;
    }
Example #5
0
 public void SetCameraDizzyEffect()
 {
     currentCameraEffect = CameraEffect.Dizzy;
     ((MonoBehaviour)MainCamera.GetComponent("Vignetting")).enabled = false;
     ((MonoBehaviour)MainCamera.GetComponent("Blur")).enabled       = false;
     MainCamera.GetComponent <MotionBlur>().enabled = true;
 }
    public void TransitionEffectState(CameraEffect i_effectState)
    {
        if (currentEffectState_ == i_effectState)
        {
            return;
        }

        switch (i_effectState)
        {
        case CameraEffect.NoWaterCool:
            waterLight.gameObject.SetActive(false);
            sunLight.color = sunLightCool;
            break;

        case CameraEffect.NoWaterHot:
            waterLight.gameObject.SetActive(false);
            sunLight.color = sunLightHot;
            break;

        case CameraEffect.WaterCool:
            waterLight.gameObject.SetActive(true);
            sunLight.color = sunLightCool;
            break;

        case CameraEffect.WaterHot:
            waterLight.gameObject.SetActive(true);
            sunLight.color = sunLightHot;
            break;
        }
        currentEffectState_ = i_effectState;
    }
Example #7
0
    protected override void InitAbility()
    {
        // Get the main camera of the scene
        Camera lCamera = Camera.main;

        if
        (lCamera != null)
        {
            // Get the camera effect to desactivate the blur
            CameraEffect lCameraEffect = lCamera.GetComponent(typeof(CameraEffect)) as CameraEffect;

            if
            (lCameraEffect != null)
            {
                mNormalVisionActivated = true;
                lCameraEffect.enabled  = false;
            }
        }

        if
        (!mNormalVisionActivated)
        {
            Console.WriteLine("Impossible to desactivate the blur vision.");
        }
    }
Example #8
0
    void Wait()
    {
        stateTurn = State.wait;
        CameraEffect.Saturate(-36.6f, 0.3f);
        CameraEffect.Grain(0.3f, 0.2f);
        wait = 3.8f;
        if (valideState == players.Count - 1)
        {
            score.SetScore();
            ++state;
        }
        else if (!players[state % players.Count].dead)
        {
            score.IncrementBuffer();
        }

        switch (state % players.Count)
        {
        case 0: waiting.color = new Color(0.7f, 0.36f, 0.36f); break;

        case 1: waiting.color = new Color(0.36f, 0.57f, 0.7f); break;

        default: waiting.color = new Color(0.39f, 0.7f, 0.36f);  break;
        }

        timerImage.color = waiting.color;

        for (int i = 0; i < players.Count; ++i)
        {
            players[i].ActivePlayerVisual(i == state % players.Count);
        }
    }
Example #9
0
 protected override void Start()
 {
     base.Start();
     m_cameraEffect         = m_camera.gameObject.GetComponent <CameraEffect>();
     m_cameraEffect.enabled = true;
     Init();
 }
Example #10
0
    public void RenderBloomTexture(RenderTexture source, RenderTexture dest)
    {
        RenderTexture curRenderTex = RenderTextureManager.Instance.RequestRenderTexture(source.width, source.height, source.depth, source.format);

        //Prepare by extracting blooming pixels
        Graphics.Blit(source, curRenderTex, Mat, 0);  //Is it ok to extract blooming pixels at 1/4 res??????

        //Downsample & blur
        for (int i = 1; i <= bloomSamples; i++)
        {
            float curSpread = Mathf.Lerp(1f, 2f, (float)(i - 1) / (float)(bloomSamples));

#if FXPRO_EFFECT
            RenderTextureManager.Instance.SafeAssign(ref curRenderTex, CameraEffect.DownsampleTex(curRenderTex, 2f));
#elif BLOOMPRO_EFFECT
            RenderTextureManager.Instance.SafeAssign(ref curRenderTex, BloomPro.DownsampleTex(curRenderTex, 2f));
#elif DOFPRO_EFFECT
            RenderTextureManager.Instance.SafeAssign(ref curRenderTex, DOFPro.DownsampleTex(curRenderTex, 2f));
#endif

            RenderTextureManager.Instance.SafeAssign(ref curRenderTex, BlurTex(curRenderTex, curSpread));

            //Set blurred bloom texture
            Mat.SetTexture("_DsTex" + i, curRenderTex);
        }

        //Bloom composite pass
        Graphics.Blit(null, dest, Mat, 1);

        RenderTextureManager.Instance.ReleaseRenderTexture(curRenderTex);
    }
Example #11
0
    public void IncrementBuffer()
    {
        buffer -= 100;

        CameraEffect.Shake(2, 0.5f);
        lifebar[bufferI].Activate(false);
        --bufferI;
        if (bufferI == 1)
        {
            for (int i = 0; i <= bufferI; ++i)
            {
                lifebar[i].SetColor(Color.red);
            }
        }
        if (bufferI == 0)
        {
            lifebar[0].Shake();
        }

        if (buffer < 0)
        {
            buffer = 0;
        }
        if (buffer == 0)
        {
            GameOver();
        }
    }
Example #12
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #13
0
 private void Start()
 {
     center = player.transform.position;
     GameManager.Instance.OnSceneChangeCallback += RotateCamera;
     cameraEffect   = GetComponent <CameraEffect>();
     positionOffset = offsetIn2D;
     rotationOffset = transform.rotation.eulerAngles;
 }
Example #14
0
 public virtual void OnRecycle()
 {
     if (camEffect)
     {
         GameObject.DestroyImmediate(camEffect);
         camEffect = null;
     }
 }
Example #15
0
 // Use this for initialization
 void Awake()
 {
     Instance             = this;
     m_renderTexture      = new RenderTexture(Screen.width, Screen.height, 0);
     m_smallRenderTexture = new RenderTexture(m_checkWith, m_checkHeight, 0);
     m_texture2D          = new Texture2D(m_checkWith, m_checkHeight);
     m_outputTex          = new Texture2D(m_checkWith, m_checkHeight);
 }
Example #16
0
    public void OnDisable()
    {
        CameraEffect cameraeffect = (CameraEffect)target;

        if (cameraeffect.effect != null)
        {
            cameraeffect.effect.enabled = false;
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     if (Camera.main != null)
     {
         _cameraEffect = Camera.main.GetComponent <CameraEffect>();
     }
     _enemyDetector = GetComponent <EnemyDetector>();
     rb             = GetComponent <Rigidbody>();
 }
Example #18
0
 public virtual void Initialize()
 {
     camEffect = Camera.main.GetComponent <CameraEffect>();
     if (!camEffect)
     {
         camEffect = Camera.main.gameObject.AddComponent <CameraEffect>();
     }
     camEffect.enabled = false;
 }
    void Awake()
    {
        fadeSprite.gameObject.SetActive(true);
        fadeSprite.color = Color.black;

        blockScreen.SetActive(true);

        Instance = this;
    }
Example #20
0
 void Awake()
 {
     _rigidbody = GetComponent <Rigidbody2D>();
     if (isMe)
     {
         _cameraEffect = Camera.main.GetComponent <CameraEffect>();
         SetPos(GetRandomSpawnPoint());
     }
 }
Example #21
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning(name + ": 存在多个CameraEffect! 将删除多余CameraEffect。");
            Destroy(this);
        }

        instance = this;
    }
Example #22
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #23
0
 // Start is called before the first frame update
 void Awake()
 {
     _volume           = FindObjectOfType <Volume>();
     _chromatic        = (ChromaticAberration)_volume.profile.components.Find(x => x.name == "ChromaticAberration(Clone)");
     _colorAdjustments = (ColorAdjustments)_volume.profile.components.Find(x => x.name == "ColorAdjustments(Clone)");
     _grain            = (FilmGrain)_volume.profile.components.Find(x => x.name == "FilmGrain(Clone)");
     shakeList         = new List <float>();
     Debug.Log("Set CamEffect");
     instance = this;
     _cam     = GetComponent <CinemachineVirtualCamera>();
     _noise   = _cam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
 }
Example #24
0
    }                                                           // getter

    // 초기화
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        cameraEffect = Camera.main.GetComponent <CameraEffect>();

        isTouch         = false;
        previousIsTouch = false;
    }
    public void SwitchEffect(CameraEffect cameraEffect)
    {
        curEffect = cameraEffect;
        switch (curEffect)
        {
        case CameraEffect.None:
            Camera.main.orthographicSize = orgSize;
            break;

        case CameraEffect.Shake:
            break;
        }
    }
Example #26
0
 protected void End(bool kill = false)
 {
     if (!kill && !owner.play)
     {
         CameraEffect.Shake(0.5f, 0.1f);
     }
     timerEnd          = _manager.timer;
     active            = false;
     _renderer.enabled = false;
     transform.GetComponent <Collider2D>().enabled              = false;
     transform.GetComponentInChildren <Collider2D>().enabled    = false;
     transform.GetComponentInChildren <TrailRenderer>().enabled = false;
 }
    // Start is called before the first frame update
    private void Start()
    {
        playerMovement = GetComponent <PlayerMovement>();
        if (Camera.main != null)
        {
            mainCamera    = Camera.main;
            _cameraEffect = mainCamera.GetComponent <CameraEffect>();
        }

        isFacingRight = true;
        onFacingChangeCallback?.Invoke(true);
        canControl = true;
    }
Example #28
0
    public void CameraShake(string paramName)
    {
        PA_Param param = FindParam(paramName);

        if (param == null)
        {
            return;
        }
        GameObject center = param.GetGameObject(0);

        //float radius = param.GetFloat(0);
        bool shouldStart = false;

        if (center != null)
        {
            //if( CoreEntry.gTeamMgr.MainPlayer != null )
            //{
            //    if( radius <= 0 )
            //    {
            //        shouldStart = true;
            //    }
            //    else if ((CoreEntry.gTeamMgr.MainPlayer.transform.position - center.transform.position).magnitude <= radius)
            //    {
            //        shouldStart = true;
            //    }
            //}
        }
        else
        {
            shouldStart = true;
        }

        if (shouldStart)
        {
            Camera cam = GetCameraFromParam(param, 1);
            if (cam != null)
            {
                float scale = param.GetFloat(1);
                if (scale <= 0f)
                {
                    scale = 1f;
                }
                CameraEffect effect = GetARequiredComponent <CameraEffect>(cam.gameObject);
                if (effect != null)
                {
                    effect.Scale = scale;
                    effect.ShakeStart();
                }
            }
        }
    }
Example #29
0
        void OnEnable()
        {
            if (mainCamera == null)
            {
                mainCamera = Camera.main;
            }

            // ensure the SpriteLightKitPostProcessor is on the Camera
            _slkImageEffect = mainCamera.GetComponent <CameraEffect>();
            if (_slkImageEffect == null)
            {
                _slkImageEffect = mainCamera.gameObject.AddComponent <CameraEffect>();
            }
            UpdateCamera();
        }
Example #30
0
    void Rewind()
    {
        stateTurn = State.rewind;
        CameraEffect.Saturate(-90, 1.5f);
        CameraEffect.Grain(0.9f, 0.5f);
        for (int i = 0; i < players.Count; ++i)
        {
            players[i].ToRewind();
        }

        foreach (Bullet b in bullets)
        {
            b.Rewind();
        }
    }
Example #31
0
 void Awake()
 {
     instance = this;
 }