Example #1
0
    void Colorize(int color)
    {
        impulseSource.GenerateImpulseAt(transform.position, Vector3.one * 0.5f);
        cam.BaseEffect(2);

        currentColor = color;

        pc.groundLayer   = Manager.Instance.masks[color];
        pc.canJumpLayers = Manager.Instance.masks[color];

        AudioManager.Instance.PlayEffectAt(16, face.transform.position, 0.899f);
        AudioManager.Instance.PlayEffectAt(17, face.transform.position, 0.777f);
        AudioManager.Instance.PlayEffectAt(14, face.transform.position, 0.688f);
        AudioManager.Instance.PlayEffectAt(3, face.transform.position, 1f);


        EffectManager.Instance.AddEffectToParent(0, transform.position - Vector3.up * 0.75f, transform);

        gameObject.layer = 13 + color;
        tail.layer       = 13 + color;

        var c  = Manager.Instance.colors[color];
        var sc = Manager.Instance.shineColors[color];

        colorSprites.ToList().ForEach(sprite => sprite.color = c);
        shineSprites.ToList().ForEach(sprite => sprite.color = sc);
        limbSprites.ToList().ForEach(sprite => sprite.color  = c);
    }
Example #2
0
 // Update is called once per frame
 void DoEffect()
 {
     if (effectCamera)
     {
         effectCamera.BaseEffect(0.2f);
     }
 }
Example #3
0
 public void Choose(int num)
 {
     locked = true;
     cam.BaseEffect();
     ProgressManager.Instance.selectedPlayerColor = num;
     ProgressManager.Instance.GenerateOpponentColor();
     Invoke("StartFade", 0.25f);
     Invoke("StartLoading", 2f);
 }
Example #4
0
    private void DoGrab()
    {
        gameObject.SetActive(false);
        EffectManager.Instance.AddEffect(3, transform.position);
        EffectManager.Instance.AddEffect(2, transform.position);

        AudioManager.Instance.DoExplosion(transform.position, 0.5f);
        AudioManager.Instance.PlayEffectAt(14, transform.position, 1.2f);

        cam.BaseEffect(0.75f);
    }
Example #5
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Spikes")
        {
            Die();
            return;
        }

        if (coll.gameObject.tag == "Mate")
        {
            EffectManager.Instance.AddEffect(5, coll.contacts [0].point);

            if (!hasEnded)
            {
                hasEnded = true;
                face.Emote(Face.Emotion.Brag);
                info.ShowText("MILLIE FEELS GRATEFUL", "...ALSO HORNY");
                MessageSound();
                Invoke("TheEnd", 5f);
            }
        }

        float dieLimit = thickSkin ? 30f : 15f;

        if (coll.relativeVelocity.magnitude > dieLimit)
        {
            Die();
        }
        else
        {
            AudioManager.Instance.PlayEffectAt(0, transform.position, Mathf.Clamp(coll.relativeVelocity.magnitude * 0.05f, 0f, 2f));

            if (coll.relativeVelocity.magnitude > 5f)
            {
                EffectManager.Instance.AddEffect(6, coll.contacts [0].point);

                hasDoubleJumped = false;
                cam.BaseEffect(coll.relativeVelocity.magnitude * 0.1f);
            }
        }
    }
Example #6
0
    public void ClearGore()
    {
        foreach (var g in gores)
        {
            var gore = g.GetComponentInParent <Gore>();
            cam.BaseEffect(1.2f);
            EffectManager.Instance.AddEffect(1, g.transform.position);
            EffectManager.Instance.AddEffect(7, g.transform.position);
            EffectManager.Instance.AddEffect(0, g.transform.position);
            EffectManager.Instance.AddEffect(gore.goreColorIndex, g.transform.position);
            EffectManager.Instance.AddEffect(2, g.transform.position);

            AudioManager.Instance.DoExplosion(g.transform.position, 0.6f);

            Destroy(g.gameObject);

            cam.BaseEffect(1.5f);
        }

        gores.Clear();
    }
Example #7
0
    private void HandEffect()
    {
        gameObject.layer = 0;
        EffectManager.Instance.AddEffect(0, pos);
        EffectManager.Instance.AddEffect(1, pos);

        AudioManager.Instance.PlayEffectAt(10, pos, 1.25f);
        AudioManager.Instance.PlayEffectAt(18, pos, 1.5f);
        AudioManager.Instance.PlayEffectAt(23, pos, 1f);

        cam.BaseEffect(0.5f);
    }
Example #8
0
    public void OnMouseUp()
    {
//		Manager.Instance.Calculate ();
        clicked = true;
        clickEvent.Invoke();

        ChangeVisibility(false);

        AudioManager.Instance.PlayEffectAt(1, transform.position, 0.5f);
        EffectManager.Instance.AddEffect(1, transform.position + Vector3.up * transform.lossyScale.y * 0.75f);

        cam.BaseEffect();
    }
Example #9
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Pickup")
        {
            var t = collision.gameObject.transform;
            flock.AddScore();
            flock.AddBird(t.position);

            EffectManager.Instance.AddEffect(4, t.position);

            AudioManager.Instance.PlayEffectAt(2, t.position, 1f);
            AudioManager.Instance.PlayEffectAt(3, t.position, 1f);
            AudioManager.Instance.PlayEffectAt(1, t.position, 0.397f);
            AudioManager.Instance.PlayEffectAt(7, t.position, 0.721f);
            AudioManager.Instance.PlayEffectAt(6, t.position, 0.462f);

            t.position = flock.GetPointInLevel();


            cam.BaseEffect(0.15f);

            canBoost = true;
        }
    }
Example #10
0
    public void Die()
    {
        if (dead)
        {
            return;
        }

        Manager.Instance.level.deaths = true;

        AudioManager.Instance.DoExplosion(transform.position, 1f);

        cam.BaseEffect(3f);

        dead = true;

        var col = Random.Range(3, 6);

        EffectManager.Instance.AddEffect(col, transform.position);
        EffectManager.Instance.AddEffect(2, transform.position);
        EffectManager.Instance.AddEffect(1, transform.position);
        EffectManager.Instance.AddEffect(7, transform.position);

        var gore = EffectManager.Instance.AddEffect(6, transform.position).GetComponent <Gore>();

        gore.transform.rotation = transform.rotation;

        gore.leftHair.sprite   = hair.sprite;
        gore.rightHair.sprite  = hair.sprite;
        gore.leftBeard.sprite  = beard.sprite;
        gore.rightBeart.sprite = beard.sprite;
        gore.leftHorns.sprite  = horns.sprite;
        gore.rightHorns.sprite = horns.sprite;

        gore.goreColorIndex = col;

        gore.transform.localScale *= scaleMod;

        Manager.Instance.CancelCreate();

        Destroy(gameObject);
    }
Example #11
0
    public void ExplodeNow()
    {
        cam.BaseEffect(2f);

        AudioManager.Instance.PlayEffectAt(3, transform.position, 1.0f);
        AudioManager.Instance.PlayEffectAt(5, transform.position, 1.0f);
        AudioManager.Instance.PlayEffectAt(0, transform.position, 1.0f);

        Vector3 pos = transform.position;

        pos.z = 0;

        EffectManager.Instance.AddEffect(0, pos);
        EffectManager.Instance.AddEffect(1, pos);
        EffectManager.Instance.AddEffect(5, pos);

        ParticleSystem colorBits = EffectManager.Instance.AddEffect(3, pos).GetComponent <ParticleSystem>();

        ParticleSystem.MainModule mm = colorBits.main;
        mm.startColor = colorSprite.color;

        Destroy(gameObject);
    }
Example #12
0
    public void Calculate()
    {
        if (matrixArea.CardCount() > 0 && operatorArea.CardCount() > 0)
        {
            cam.BaseEffect();

            CancelInvoke("HintOrTaunt");

            locked = true;

            Card c  = matrixArea.PopCard();
            Card oc = operatorArea.PopCard();
            int  op = oc.GetOperation();

            if (op == 0)
            {
                resultMatrix.Add(c.GetMatrix());
            }

            if (op == 1)
            {
                resultMatrix.Subtract(c.GetMatrix());
            }

            if (op == 2)
            {
                resultMatrix.Multiply(c.GetMatrix());
            }

            EffectManager.Instance.AddEffect(0, c.transform.position);
            EffectManager.Instance.AddEffect(0, oc.transform.position);

            Destroy(c.gameObject);
            Destroy(oc.gameObject);

            handArea.SpawnCards(1, 1);

            calcButton.ChangeVisibility(false);

            int winner = resultMatrix.CheckLines(playerNum, opponentNum);

            roundEnded = false;

            if (winner != -1 && currentTurn == 0)
            {
                playerBlock.face.Emote(Face.Emotion.Happy);
                opponentBlock.face.Emote(Face.Emotion.Sad);
                roundEnded = true;

                DisplayText("You win!", nextButton, 1f);
            }

            if (winner != -1 && currentTurn == 1)
            {
                opponentBlock.face.Emote(Face.Emotion.Happy);
                playerBlock.face.Emote(Face.Emotion.Sad);
                roundEnded = true;

                DisplayText("You lose!", retryButton, 1f);
            }

            turnNumber++;
            currentTurn = (currentTurn + 1) % 2;

//			currentTurn = 0; // always player turn

            if (!roundEnded)
            {
                UpdateTurnIndicators();

                AudioManager.Instance.Highpass(currentTurn == 1);
            }
            else
            {
                turnIndicators [0].Hide();
                turnIndicators [1].Hide();
            }

            if (turnNumber >= 4 && currentTurn == 0)
            {
                ProgressManager.Instance.SpaceTutorial();
            }

            CancelInvoke("HintOrTaunt");

            if (currentTurn == 0 && !roundEnded)
            {
                bubble.CheckQueuedMessages();
                Invoke("HintOrTaunt", Random.Range(5f, 20f));
            }

            if (currentTurn == 1 && !roundEnded)
            {
                OpponentTurn();
            }

            if (!roundEnded)
            {
                locked = false;
            }
            else
            {
                AudioManager.Instance.Highpass(true);
            }
        }
    }
Example #13
0
 public void BaseEffect(float mod = 1f)
 {
     cam.BaseEffect(mod);
 }
Example #14
0
    public void TryMove()
    {
        //Debug.Log("Trying to move @ " + Time.time);

        var neighbors = GetNeighbors().Where(n => n != null && CanJumpTo(n));

        if (neighbors.Any())
        {
            var best = neighbors.OrderBy(c => Random.value).OrderByDescending(c => c.GetValue()).FirstOrDefault();

            if (best)
            {
                Tweener.Instance.MoveTo(transform, best.transform.position, 0.25f, 0.06f, TweenEasings.QuadraticEaseInOut);
                anim.SetTrigger("jump");

                this.StartCoroutine(() => LandSound(), 0.5f);

                JumpSound();

                suit  = best.GetSuit();
                value = best.GetValue();

                var diff = best.transform.position.x - transform.position.x;
                if (Mathf.Abs(diff) > 0.5f)
                {
                    transform.localScale = new Vector3(Mathf.Sign(diff) * scale, scale, 1f);
                }

                deck.SetPreview(best);

                Invoke("TryMove", 0.7f);

                var bonus = best.HasBonus();

                this.StartCoroutine(() =>
                {
                    comboDisplay.Show();

                    var amt      = best.GetValue();
                    var addition = amt * combo * (bonus ? 10 : 1);
                    score       += addition;
                    comboScore.Add(addition);

                    this.StartCoroutine(() => {
                        var text = amt + "<size=3> x " + (combo - 1) + "</size>";
                        if (bonus)
                        {
                            text += "<size=3> x 10</size>";
                        }
                        EffectManager.Instance.AddText(text, transform.position + Vector3.up * 0.2f);
                    }, 0.25f);

                    if (bonus)
                    {
                        AudioManager.Instance.PlayEffectAt(3, transform.position, 1.44f);
                        AudioManager.Instance.PlayEffectAt(6, transform.position, 1.215f);
                        AudioManager.Instance.PlayEffectAt(8, transform.position, 1f);
                        AudioManager.Instance.PlayEffectAt(16, transform.position, 1.388f);
                        AudioManager.Instance.PlayEffectAt(18, transform.position, 1.534f);
                        AudioManager.Instance.PlayEffectAt(11, transform.position, 1.15f);
                    }

                    this.StartCoroutine(() => {
                        cam.BaseEffect(bonus ? 0.25f : 0.1f);
                        EffectManager.Instance.AddEffect(1, transform.position + Vector3.down * 0.5f);

                        if (bonus)
                        {
                            EffectManager.Instance.AddEffect(3, transform.position);
                            deck.board.DoBonus();
                        }
                    }, 0.25f);

                    Instantiate(blockPrefab, best.transform.position, Quaternion.identity);
                    Destroy(best.gameObject);

                    deck.board.Moved();

                    combo++;
                }, 0.3f);

                return;
            }
        }

        var amount = comboScore.GetValue();

        if (amount > 0)
        {
            this.StartCoroutine(() =>
            {
                totalScore.Add(amount);
                comboScore.Clear();
                this.StartCoroutine(comboDisplay.Hide, 0.5f);
            }, 0.7f);
        }

        NextText();

        deck.AddCard();
        combo = 1;

        this.StartCoroutine(CheckForEnd, 0.5f);
    }
Example #15
0
    // Update is called once per frame
    public bool Launch(Cinemachine.CinemachineVirtualCamera fCam, Vector3 dir, bool manualTorque = false, float torqueAmount = 0f)
    {
        if (!isAlive)
        {
            return(false);
        }

        if (!firstJump && !jumper)
        {
            return(false);
        }

        if (!firstJump && !isAttached && !isGrabbed)
        {
            return(false);
        }

        isAttached = false;

        activatedBlocks.ForEach(b => b.Deactivate());
        activatedBlocks.Clear();

        grabbers.ForEach(g => g.Detach());

        followCam = fCam;
        followCam.gameObject.SetActive(true);
        followCam.Follow = body.transform;

        body.bodyType = RigidbodyType2D.Dynamic;
        limbs.ToList().ForEach(l => l.bodyType = RigidbodyType2D.Dynamic);

        line.enabled = false;

        body.AddForce(dir * 150f, ForceMode2D.Impulse);

        if (activatedBlocks.Any())
        {
            activatedBlocks.ForEach(b => b.Deactivate());
        }

        if (firstJump)
        {
            var amt = manualTorque ? torqueAmount * 3000f : dir.x * 100f;
            body.AddTorque(amt, ForceMode2D.Impulse);
            cam.BaseEffect(1.1f);

            AudioManager.Instance.PlayEffectAt(32, transform.position, 2f);
            AudioManager.Instance.PlayEffectAt(29, transform.position, 0.489f);
            AudioManager.Instance.PlayEffectAt(47, transform.position, 0.852f);
            AudioManager.Instance.PlayEffectAt(49, transform.position, 1f);
        }

        AudioManager.Instance.PlayEffectAt(31, transform.position, 0.723f);
        AudioManager.Instance.PlayEffectAt(25, transform.position, 1.104f);
        AudioManager.Instance.PlayEffectAt(37, transform.position, 1.241f);
        AudioManager.Instance.PlayEffectAt(40, transform.position, 1f);
        AudioManager.Instance.PlayEffectAt(42, transform.position, 0.643f);

        hands.ToList().ForEach(h => h.AddForce(dir * Random.Range(5f, 10f), ForceMode2D.Impulse));

        var ret = firstJump;

        firstJump = false;

        return(ret);
    }
Example #16
0
    public void Vote(int score)
    {
        if (!canVote)
        {
            return;
        }

        canVote = false;
        adding  = false;

        var success = (score < 0 && currentComment.score < 0 || score > 0 && currentComment.score > 0);
        var dir     = success ? 1 : -1;
        var amt     = Mathf.Abs(currentComment.score);
        var sign    = success ? "+" : "-";

        addition.text = sign + amt.ToString();

        if (multiplier > 1 && dir > 0)
        {
            addition.text += "<size=28>X</size>" + multiplier;
        }

        totalScore += amt * dir * multiplier;

        scoreChangeSpeed = amt * multiplier * Time.deltaTime;

        addition.transform.localPosition = addSpot;

        EffectManager.Instance.AddEffect(0, addition.transform.position);

        ScoreManager.Instance.SubmitScore(PlayerPrefs.GetString("PlayerName"), totalScore);

        Tweener.Instance.ScaleTo(addition.transform, Vector3.one, 0.33f, 0f, TweenEasings.BounceEaseOut);
        Invoke("MoveAddition", 1f);

        Invoke("HideVoteWindow", 0.5f);
        Invoke("HideCommentWindow", 2f);
        Invoke("HidePostWindow", 2.5f);

        if (success)
        {
            Invoke("AddCombo", 0.5f);
        }
        else
        {
            Invoke("ClearCombo", 0.5f);

            //Application.OpenURL("https://reddit.com" + reddit.CurrentPost.permalink);
            //Debug.Log(currentComment.score + " by " + currentComment.author + " : " + currentComment.body);
        }

        if (doComboTutorial && success)
        {
            tutorialStep = 0;
            StartCoroutine(DoComboTutorial());
        }
        else
        {
            Invoke("HideComboWindow", 3f);
            Invoke("StartPostLoading", 3.2f);
        }

        votedPosts.Add(reddit.CurrentPost.id);

        if (votedPosts.Count > 500)
        {
            votedPosts.RemoveAt(0);
        }

        CancelInvoke("AlienComment");

        if (success)
        {
            AudioManager.Instance.PlayEffectAt(0, Vector3.zero, 1f);

            Invoke("Compliment", 0.25f);
        }
        else
        {
            AudioManager.Instance.PlayEffectAt(1, Vector3.zero, 1f);
            AudioManager.Instance.PlayEffectAt(2, Vector3.zero, 1f);

            Invoke("Bark", 0.25f);

            cam.BaseEffect(2f);

            AudioManager.Instance.Lowpass(true);
            AudioManager.Instance.targetPitch = 0.6f;
        }

        PlayerPrefs.SetString("VotedPosts", System.String.Join(",", votedPosts.ToArray()));
    }
Example #17
0
    bool CheckCollisions()
    {
        if (currentRoom)
        {
            var diff = currentRoom.transform.position - transform.position;

            if (diff.magnitude > 20)
            {
                Respawn();
                return(true);
            }
        }

        var returnValue = false;
        var hits        = Physics2D.OverlapCircleAll(transform.position, 0.25f, collisionMask);

        //print(string.Join(",", hits.Select(h => h.name)));

        switches.RemoveAll(ds => !ds.IsStillOn());

        var insideWall = hits.Any(h => h.gameObject.tag == "Wall");

        foreach (var h in hits)
        {
            if (h.tag == "Tail")
            {
                var part = h.GetComponent <SnakePart>();
                if (part.HasMoved() && !justReversed)
                {
                    if (hasTeleport)
                    {
                        EffectManager.Instance.AddEffect(1, transform.position);

                        transform.position += direction * 1;
                        AudioManager.Instance.PlayEffectAt(9, transform.position, 1f);
                        AudioManager.Instance.PlayEffectAt(1, transform.position, 0.571f);
                        AudioManager.Instance.PlayEffectAt(11, transform.position, 0.8f);

                        EffectManager.Instance.AddEffect(1, transform.position);
                    }
                    else
                    {
                        //print("Colliding with " + part.gameObject.name);
                        Respawn();
                        returnValue = true;
                    }
                }
            }

            if (h.tag == "Wall")
            {
                if (!immortal)
                {
                    Respawn();
                    returnValue = true;
                }
                else
                {
                    Burrow();
                    frozen = true;
                }
            }

            if (h.tag == "Pickup")
            {
                var pickup = h.GetComponent <Pickup>();
                AddTail();
                ApplySkill(pickup.power);

                EffectManager.Instance.AddEffect(1, transform.position);
                EffectManager.Instance.AddEffect(3, transform.position);

                cam.BaseEffect(0.1f);

                var vol = 0.8f;
                AudioManager.Instance.PlayEffectAt(8, transform.position, 2f * vol);
                AudioManager.Instance.PlayEffectAt(17, transform.position, 2f * vol);
                AudioManager.Instance.PlayEffectAt(21, transform.position, 0.743f * vol);
                AudioManager.Instance.PlayEffectAt(23, transform.position, 0.506f * vol);
                AudioManager.Instance.PlayEffectAt(31, transform.position, 1f * vol);
                AudioManager.Instance.PlayEffectAt(29, transform.position, 1.273f * vol);
                AudioManager.Instance.PlayEffectAt(26, transform.position, 1f * vol);
                AudioManager.Instance.PlayEffectAt(22, transform.position, 1f * vol);

                if (pickup.help)
                {
                    pickup.help.Show();
                }

                if (length == 5)
                {
                    messages[0].Show(true);
                }

                if (length == 7)
                {
                    messages[1].Show(true);
                }

                if (length == 8)
                {
                    messages[2].Show(true);
                }

                if (length < 8)
                {
                    var x = Random.Range(-5, 6);
                    var y = Random.Range(-4, 5);
                    h.transform.position = new Vector3(x, y, 0);
                }
                else
                {
                    currentRoom.Grab(pickup);
                }
            }

            if (h.tag == "Switch")
            {
                var vol = 0.7f;
                AudioManager.Instance.PlayEffectAt(7, transform.position, 1f * vol);
                AudioManager.Instance.PlayEffectAt(5, transform.position, 1f * vol);
                AudioManager.Instance.PlayEffectAt(9, transform.position, 1f * vol);

                var ds = h.GetComponent <DoorSwitch>();
                switches.Add(ds);
                ds.Toggle(true);
            }

            if (!insideWall && h.tag == "Room" && (!currentRoom || h.transform != currentRoom.transform))
            {
                if (currentRoom)
                {
                    frozen   = false;
                    immortal = false;
                    currentRoom.MarkDone();

                    CancelInvoke("StartMove");
                    Invoke("StartMove", 0.7f);

                    if (!hasRevealed && hasFullMap)
                    {
                        hasRevealed = true;
                        currentRoom.RevealAll();
                    }

                    if (!hasEnhanced && hasEnhancedMap)
                    {
                        hasEnhanced        = true;
                        mapCam.cullingMask = enhancedMapMask;
                    }

                    if (!yeahed)
                    {
                        yeahed = true;
                        messages[3].Show(true);
                    }
                }

                spawnPos = RoundVector(transform.position);

                spawnDir    = direction;
                spawnLength = length;
                currentRoom = h.GetComponent <Room>();
                currentRoom.Reveal();
                Tweener.Instance.MoveTo(camRig, h.transform.position, 0.3f, 0, TweenEasings.BounceEaseOut);

                if (currentRoom.last)
                {
                    messages[5].Show(false);
                    frozen = true;
                    ended  = true;
                }
            }
        }

        justReversed = false;

        return(returnValue);
    }
Example #18
0
 public void CollapseSound()
 {
     AudioManager.Instance.PlayEffectAt(8, transform.position, 0.5f);
     cam.BaseEffect(1.5f);
 }
Example #19
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        var mag  = other.relativeVelocity.magnitude;
        var dude = other.gameObject.GetComponentInParent <Dude>();
        var p    = other.contacts[0].point;

        if (dude && dude.direction > 0)
        {
            gameStats.AddToucher(dude);
        }

        if (mag > 1f)
        {
            AudioManager.Instance.PlayEffectAt(0, p, Mathf.Clamp(mag * 0.3f, 0f, 10f));
        }

        if ((other.gameObject.CompareTag("Ground") || other.gameObject.CompareTag("Net")) && mag > 7f)
        {
            EffectManager.Instance.AddEffect(1, p);

            if (mag > 5)
            {
                cam.BaseEffect(Mathf.Clamp(mag * 0.01f, 0f, 0.5f));
            }
        }

        if (!other.gameObject.CompareTag("Hand") && !other.gameObject.CompareTag("Net") && homingAmount > 0f)
        {
            ClearHoming();
        }

        if (mag > 3f)
        {
            var amount = Mathf.Clamp(mag * 0.02f, 0f, 0.25f);
            var normal = other.contacts[0].normal;
            var x      = normal.x < normal.y ? 1f + amount : 1f - amount;
            var y      = normal.x > normal.y ? 1f + amount : 1f - amount;

            transform.parent.localScale = new Vector3(x, y, 1);
        }

        if (homingAmount > 0f && other.gameObject.CompareTag("Hand") && dude && dude != lastHit)
        {
            gameStats.CompleteChallenge(7);
        }

        if (mag > effectLimit)
        {
            cam.BaseEffect(other.relativeVelocity.magnitude * 0.01f);
            EffectManager.Instance.AddEffect(0, body.position);

            if (other.gameObject.CompareTag("Hand"))
            {
                if (other.relativeVelocity.magnitude > 5f)
                {
                    EffectManager.Instance.AddEffect(2, other.contacts[0].point);
                }

                if (mag > 20f && stopCooldown <= 0f && other.rigidbody.velocity.magnitude > 12f)
                {
                    body.angularVelocity = 500f * (0.5f + dude.GetRawStat(Stat.Spin) * 0.25f) * dude.direction;
                    stopCooldown         = 0.5f;
                    Time.timeScale       = 0f;
                    this.StartCoroutine(() => Time.timeScale = 1f, 1f / 60f);

                    if (body.angularVelocity > 550f && dude.direction > 0)
                    {
                        gameStats.CompleteChallenge(6);
                    }

                    if (dude && dude.partner == lastHit)
                    {
                        if (dude.direction > 0)
                        {
                            gameStats.CompleteChallenge(1);
                        }

                        AddHoming(dude.GetStat(Stat.Super), dude.direction);
                        dude.partner.SayNice(Random.Range(0.2f, 0.4f));

                        AudioManager.Instance.PlayEffectAt(10, body.position, 1f);
                        AudioManager.Instance.PlayEffectAt(9, body.position, 0.465f);
                        AudioManager.Instance.PlayEffectAt(22, body.position, 0.759f);
                        AudioManager.Instance.PlayEffectAt(16, body.position, 1f);
                        AudioManager.Instance.PlayEffectAt(15, body.position, 1f);
                    }
                }

                if (!lastHitNoReset)
                {
                    hitter = dude;
                }

                if (lastHitNoReset && Math.Abs(lastHitNoReset.direction - dude.direction) > 0.1f)
                {
                    hitter = lastHitNoReset;
                }

                lastHit = dude;
                if (dude)
                {
                    lastHitNoReset = dude;
                }
                CancelInvoke(nameof(ResetLastTouch));
                Invoke(nameof(ResetLastTouch), dude.GetStat(Stat.Super));
            }
        }

        if (mag > 10f)
        {
            EffectManager.Instance.AddEffect(0, other.contacts[0].point);
        }
    }
Example #20
0
    // Update is called once per frame
    void Update()
    {
        Vector3 mp = Input.mousePosition;

        mp.z = 10f;
        Vector3 mouseInWorld = cam.ScreenToWorldPoint(mp);

        transform.position = mouseInWorld;

        if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && !dead)
        {
            UseCursor(true);

            hasBoosted = true;

            var boostCount = birds.Count(b => b.CanBoost());

            effectCamera.BaseEffect(Mathf.Min(boostCount * 0.03f, 0.5f));

            if (boostCount > 0)
            {
                AudioManager.Instance.curMusic.pitch = 1.2f;
            }

            birds.ForEach(b => b.Boost());

            if (toldBoost)
            {
                HideHelp();
            }
        }

        if (Input.GetKeyDown(KeyCode.R) && Application.isEditor)
        {
            SceneManager.LoadScene("Main");
        }

        if (canRestart)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                canRestart = false;
                SceneChanger.Instance.ChangeScene("Start");
                return;
            }

            //if (Input.anyKeyDown)
            //{
            //    canRestart = false;
            //    SceneChanger.Instance.ChangeScene("Main");
            //    return;
            //}

            ShowHelp("<size=25>SCORE UPLOADED!</size>\n<size=15>" + ScoreManager.Instance.GetRank() + "</size>", 0, true);
        }

        var scrollSpeed = Mathf.Max(20f, score - shownScore);

        shownScore     = Mathf.MoveTowards(shownScore, score, Time.deltaTime * scrollSpeed * 2f);
        scoreText.text = FormatScore(Mathf.RoundToInt(shownScore));

        //collisions = all.Select(p => p.point).ToList();

        //Debug.Log(IsInside(transform.position) ? "INSIDE" : "OUTSIDE");
    }
Example #21
0
    IEnumerator WaitForAll()
    {
        while (checks > 0)
        {
            yield return(0);
        }
        var uniques  = marked.Distinct().ToList();
        var addition = score.Add(uniques.Count);

        if (uniques.Any())
        {
            uniques.ForEach(tile => tile.Boom(green));
            this.StartCoroutine(() => cam.BaseEffect(Mathf.Min(uniques.Count * 0.05f, 10f)), Tile.boomDelay);

            var w = words.OrderBy(_ => Random.value).First();
            // Debug.Log("Random one: " + w);
            definer.DefineWord(w);

            var soundPos      = uniques.First().transform.position;
            var veryNiceWords = new[] {
                "sex", "tit", "ass", "poo", "bum", "rod", "tool", "piss", "pee",
                "fart", "boob", "simp", "t**s", "dick", "dicks", "cum", "boob", "boobs", "sexy", "tittie", "titty",
                "titties", "nut", "nuts", "p**n", "turd", "poop", "burp", "bra", "hoe", "wee"
            };
            dude.NiceAt(-soundPos.x, soundPos.y > 0, words.Intersect(veryNiceWords).Any());

            // AudioManager.Instance.targetPitch = 1.1f;
            // this.StartCoroutine(() => AudioManager.Instance.targetPitch = 1f, 0.75f);
        }
        marked.Clear();
        words.Clear();

        this.StartCoroutine(() =>
        {
            if (uniques.Any())
            {
                dude.ShowTutorial(Tutorial.Word);
                dude.ShowTutorial(Tutorial.MultiReset);
            }
            else
            {
                dude.ShowTutorial(Tutorial.Multiplier);
                dude.ShowTutorial(Tutorial.Three);
            }

            if (addition > 200)
            {
                dude.ShowTutorial(Tutorial.BigRound);
            }

            if (score.IsBest())
            {
                dude.ShowTutorial(Tutorial.HiScore);
            }

            if (!dude.HasSomething())
            {
                Spawn();
            }
        }, uniques.Any() ? 2.5f : 0.3f);
    }