public void checkCollision(int button)
    {
        Ray          mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit2D hit      = Physics2D.GetRayIntersection(mouseRay, Mathf.Infinity);

        if (hit && hit.collider.name == name)
        {
            if (animator != null)
            {
                animator.SetInteger("animation", button + 1);
                Invoke("resetAnimation", .1f);
            }
        }
        else if (nextInteractive != null)
        {
            nextInteractive.checkCollision(button);
        }
        else if (ripples != null)
        {
            if (rippleCooldown <= 0f)
            {
                ripples.Emit();
                rippleCooldown = rippleCoolTime;
            }
        }
    }
Example #2
0
    public void Dash(float x, float y)
    {
        if (!simulated)
        {
            camera1.transform.DOComplete();
            camera1.transform.DOShakePosition(.2f, .5f, 14, 90, false, true);
            rippleEffect.Emit(camera1.WorldToViewportPoint(transform.position));
            anim.SetTrigger("dash");
        }
        hasDashed = true;
        var velocity = rb.velocity;

        velocity = Vector2.zero;
        Vector2 dir = new Vector2(x, y);

        velocity   += dir.normalized * dashSpeed;
        rb.velocity = velocity;

        rb.drag               = 13f;
        rb.gravityScale       = 0;
        betterJumping.enabled = false;
        wallJumped            = true;
        isDashing             = true;
        //StartCoroutine(DashWait());
    }
Example #3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Debug.Log("press mouse .");
         ripple.Emit(new Vector2(0.0f, 0.0f));
     }
 }
Example #4
0
    public override void OnNoteDown(int track, Note note)
    {
        float velNormalised = note.Velocity / 127f;

        ripple.refractionStrength = Mathf.Lerp(refracMin, refracMax, velNormalised);
        ripple.reflectionStrength = Mathf.Lerp(reflecMin, reflecMax, velNormalised);
        ripple.waveSpeed          = Mathf.Lerp(speedMin, speedMax, velNormalised);
        ripple.Emit(pos);
    }
Example #5
0
    void TouchEvent(Vector2 pos)
    {
        // ripple
        float x = pos.x / Screen.width;
        float y = pos.y / Screen.height;

        rippleEffect.Emit(new Vector2(x, y));



        // touch sectoraudioSourceBgm.time
        float centerx = Screen.width * 0.5f;
        float centery = Screen.height * 0.5f;


        // left
        if (pos.x < centerx)
        {
            // bottom
            if (pos.y < centery)
            {
                if (IsGoodTouch(TouchSectorType.TST_LeftBottom))
                {
                    GoodNote(TouchSectorType.TST_LeftBottom);
                }
            }
            // top
            else
            {
                if (IsGoodTouch(TouchSectorType.TST_LeftTop))
                {
                    GoodNote(TouchSectorType.TST_LeftTop);
                }
            }
        }
        // right
        else
        {
            // bottom
            if (pos.y < centery)
            {
                if (IsGoodTouch(TouchSectorType.TST_RightBottom))
                {
                    GoodNote(TouchSectorType.TST_RightBottom);
                }
            }
            // top
            else
            {
                if (IsGoodTouch(TouchSectorType.TST_RightTop))
                {
                    GoodNote(TouchSectorType.TST_RightTop);
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Debug.Log("press mouse .");

            Vector2 pos = new Vector2(Input.mousePosition.x / Screen.width, Input.mousePosition.y / Screen.height);
            ripple.Emit(pos);
        }
    }
Example #7
0
    public void PerformRippleEffect(Vector3 wpos)
    {
        GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");

        if (camera)
        {
            Vector3      spos = camera.GetComponent <Camera>().WorldToViewportPoint(wpos);
            RippleEffect fx   = camera.GetComponent <RippleEffect>();
            fx.Emit(spos.x, 1 - spos.y);
        }
    }
    IEnumerator Dead()
    {
        if (!dead)
        {
            dead = true;
            if (soundEnable_Rope)
            {
                AkSoundEngine.PostEvent("plays_slicing", Camera.main.gameObject);
            }
            if (soundEnable_Death)
            {
                AkSoundEngine.PostEvent("play_monster1death", Camera.main.gameObject);
            }

            blink.SpriteBlinkingEffect();
            //Used to control the vibrations in both controllers
            players[0].testVibrationHitRope = true;
            players[1].testVibrationHitRope = true;

            GetComponent <SpriteRenderer>().color = Color.white;
            enemySpeed = 0;

            yield return(new WaitForSeconds(0.2f));

            if (methodToKill == MethodToKill.Surround)
            {
                GetComponent <SpriteRenderer>().color = Color.white;
                var newPosition = Camera.main.WorldToScreenPoint(transform.position);
                newPosition = new Vector3(newPosition.x / Screen.width, newPosition.y / Screen.height);
                shockwave.Emit(newPosition.x, newPosition.y);
            }

            yield return(new WaitForSeconds(0.2f));

            Instantiate(blood_explo, new Vector3(transform.position.x, transform.position.y, blood_explo.transform.position.z), blood_explo.transform.rotation);
            if (moneyDrop != null)
            {
                moneyDrop.enabled = true;
            }

            yield return(new WaitForSeconds(0.25f));

            Destroy(gameObject);
        }
    }
Example #9
0
    IEnumerator Dead()
    {
        if (!dead)
        {
            dead = true;
            //Used to control the vibrations in both controllers
            players[0].testVibrationHitRope = true; //?
            players[1].testVibrationHitRope = true; //?

            sprite.material = flash_sprite;
            sprite.color    = Color.white;

            yield return(new WaitForSeconds(0.2f));

            sprite.material = default_sprite;
            sprite.color    = Color.white;

            if (method == MethodToKill.Surround)
            {
                var newPosition = Camera.main.WorldToScreenPoint(transform.position);
                newPosition = new Vector3(newPosition.x / Screen.width, newPosition.y / Screen.height);
                shockwave.Emit(newPosition.x, newPosition.y);
            }


            yield return(new WaitForSeconds(0.2f));

            Instantiate(blood_explo, new Vector3(transform.position.x, transform.position.y, blood_explo.transform.position.z), blood_explo.transform.rotation);

            canvas.SetActive(false);

            yield return(new WaitForSeconds(0.25f));

            GetComponentInParent <Animator>().Play("Die");
            for (int i = 0; i < players.Count; i++)
            {
                players[i].Allow_Moving();
            }
        }
    }
Example #10
0
        public override void Ability()
        {
            //Generates Cinemachine Impulse
            _impulseSource.GenerateImpulse();

            //Stops the player, to avoid large pushes
            _rgb.velocity = Vector2.zero;

            _rgb.AddForce(new Vector2(CalculateCharacterDirection().x *_force,
                                      CalculateCharacterDirection().y *_force
                                      ) / 100, ForceMode2D.Impulse);

            StartCoroutine(HandleCharacterController());

            #region Effects
            //Do Fade Effect
            StartCoroutine(FadeEffect());

            //Starts Ripple Effect
            _rippleEffect.Emit();
            #endregion
        }
Example #11
0
        public void OnClick(int bpm, int samples)
        {
            if (click)
            {
                objects.ForEach(obj => {
                    obj.GetComponent <IBPMSynchronizable>().OnClick(bpm, samples);
                });
            }

            if (ripple)
            {
                for (int i = 0, n = objects.Count; i < n; i++)
                {
                    var obj = objects[i];
                    var pos = cam.WorldToViewportPoint(obj.transform.position);
                    if (pos.x >= 0f && pos.x <= 1f && pos.y >= 0f && pos.y <= 1f && pos.z > 0f)
                    {
                        pos.y = 1f - pos.y; // flip y
                        rippleEffect.Emit(pos);
                    }
                }
            }
        }
Example #12
0
 protected void GameOver()
 {
     ripplesExplosion.Emit(new Vector2(transform.position.x / Screen.width, transform.position.y / Screen.height));
     GameManager.GameEventBus.Trigger <GameOverEvent>(new GameOverEvent());
     Deactivate();
 }
Example #13
0
 public void Launch()
 {
     Debug.Log("Crash");
     rippleEffect.Emit(Camera.main.WorldToViewportPoint(transform.position));
     audioManager.Play(clip);
 }
 public void StartSkillTime()
 {
     ripple.Emit(new Vector2(0f, 0f));
     StartCoroutine(BulletTimeCD());
 }
Example #15
0
 public static void Ripple(Vector3 pos)
 {
     _cameraRippleEffect.Emit(_mainCamera.WorldToViewportPoint(pos));
 }