public void Open(string text, WorkshopItem item)
 {
     this.opened = true;
     this._text  = text;
     SFX.Play("openClick", 0.4f);
     this._item = item;
 }
Example #2
0
    private void GameOver()
    {
        Countdown.onComplete -= GameOver;
        start = false;
        grade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints());
        PointsManager.onFinishLeveling += () => {
            GemSpawnManager.UpgradeGem(grade);

            PointsManager.gameObject.SetActive(false);
            GradeText.text  = Quality.GradeToString(grade);
            GradeText.color = Quality.GradeToColor(grade);
            GradeText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(grade), 1f, 1f, 0f, false, 0f);
        };


        PointsManager.DoEndGameTransition();

        foreach (NewCutPoint cut in activeCuts)
        {
            Destroy(cut.gameObject);
        }

        ShowUIButtons();
    }
Example #3
0
    void OnCollisionEnter2D(Collision2D col)
    {
        Rigidbody2D subject = col.collider.gameObject.GetComponent <Rigidbody2D> ();

        if (subject != null)
        {
            ContactPoint2D c    = col.contacts[0];
            Vector2        away = (col.collider.gameObject.transform.position - transform.position).normalized;

            Ship s = subject.GetComponent <Ship> ();
            if (s != null)
            {
                s.RandomTalk();
                // figure out if shielder is active on the ship, skip the collision if so.
                if (s.IsShieldedTowards(c.normal))
                {
                    body.AddForceAtPosition(-away * selfbounce, c.point, ForceMode2D.Impulse);
                    shieldedSFX.Play();
                    stuntimer = 10f;
                    return;
                }
            }

            stuntimer = .25f;
            subject.AddForceAtPosition(away * pushaway, c.point, ForceMode2D.Impulse);
            body.AddForceAtPosition(-away * selfbounce, c.point, ForceMode2D.Impulse);
            bounceSFX.Play();
        }
    }
Example #4
0
 public override void Quack(float volume, float pitch)
 {
     if (playing == null)
     {
         playing = SFX.Play(GetPath <EdoMod>("SFX\\hats\\ImFirinMyLaser"), volume, pitch, 0f, false);
     }
 }
Example #5
0
    void Start()
    {
        SFX.Play("CraftingGem", 1f, 1f, 0f, true, 0f);
        if (GameManager.Instance.ActiveGameMode == GameMode.Story)
        {
            Countdown.onComplete += GameOver;
        }
        else if (GameManager.Instance.ActiveGameMode == GameMode.Party)
        {
            Countdown.onComplete += GameOverParty;
        }

        Difficulty d = ManualDifficultyOverride ? ManualDifficulty : PersistentData.Instance.Difficulty;

        if (!DifficultySettings.TryGetValue(d, out activeDifficultySettings))
        {
            Debug.LogError("The current difficulty (" + PersistentData.Instance.Difficulty.ToString() +
                           ") does not have a CuttingDifficultySettings associated with it.");
        }

        activeCuts   = new LinkedList <NewCutPoint>();
        cutContainer = new GameObject("CutContainer");

        // Spawn our first cut straight away instead of waiting.
        timeIntervalCounter = activeDifficultySettings.InitialSpawnInterval;
    }
    public void Award()
    {
        switch (type)
        {
        case ContentsType.Ring:
            recipient.rings += 10;
            SFX.Play(audioSource, "sfxRingMonitor");
            break;

        case ContentsType.Shield:
            SFX.Play(audioSource, "sfxShieldNormal");
            recipient.shield = Instantiate(
                Constants.Get <GameObject>("prefabShieldNormal")
                ).GetComponent <ObjShield>();
            recipient.shield.character = recipient;
            break;

        case ContentsType.Life:
            recipient.lives++;
            break;

        case ContentsType.Shoes:
            recipient.effects.Add(new CharacterEffectSpeedUp(recipient));
            break;

        case ContentsType.Invincibility:
            recipient.effects.Add(new CharacterEffectInvincible(recipient));
            break;
        }
    }
    private void WipeFadeOut()
    {
        SFX.Play("Screen_wipe", 1f, 1f, 0f, false, 0f);

        DOTween.To(() => bg.fillAmount, x => bg.fillAmount = x, 0f, .7f).SetUpdate(true).SetEase(Ease.InCubic)
        .OnComplete(() => Initiate.DoneFading());
    }
        public override void Update()
        {
            this.spawnTime = 4f;
            if (this._present != null && this._present.removeFromLevel)
            {
                this._present = (CTFPresent)null;
            }
            CTFPresent ctfPresent1 = (CTFPresent)null;
            CTFPresent ctfPresent2 = (CTFPresent)null;

            foreach (CTFPresent ctfPresent3 in Level.CheckCircleAll <CTFPresent>(this.position, 16f))
            {
                if (ctfPresent3 != this._present)
                {
                    ctfPresent2 = ctfPresent3;
                }
                else
                {
                    ctfPresent1 = ctfPresent3;
                }
            }
            if (ctfPresent2 != null & ctfPresent1 != null)
            {
                if (ctfPresent2.duck != null)
                {
                    ctfPresent2.duck.ThrowItem();
                }
                Level.Remove((Thing)ctfPresent2);
                Level.Add((Thing)SmallSmoke.New(ctfPresent2.x, ctfPresent2.y));
                CTF.CaptureFlag((bool)this.team);
                SFX.Play("equip");
            }
            base.Update();
        }
Example #9
0
        public override void Fire()
        {
            if (ammo > 0)
            {
                SFX.Play(DuckUtils.GetAsset("sounds/fututre_gan.wav"));
                Vec2 vec = Offset(barrelOffset);
                if (isServerForObject)
                {
                    FututreSphere sphere = new FututreSphere(vec.x, vec.y, owner, barrelVector);
                    Fondle(sphere);

                    sphere.killThingType = GetType();
                    Level.Add(sphere);

                    if (owner != null)
                    {
                        owner.hSpeed = -barrelVector.x * 8f;
                        owner.vSpeed = -barrelVector.y * 4f - 2f;
                    }
                    else
                    {
                        hSpeed = -barrelVector.x * 8f;
                        vSpeed = -barrelVector.y * 4f - 2f;
                    }
                }
                ammo--;
            }
        }
Example #10
0
    // Use this for initialization
    void Start()
    {
        SFX.Play("CraftingOre", 1f, 1f, 0f, true, 0f);
        if (GameManager.Instance.ActiveGameMode == GameMode.Story)
        {
            Countdown.onComplete += GameOver;
        }
        else if (GameManager.Instance.ActiveGameMode == GameMode.Party)
        {
            Countdown.onComplete += GameOverParty;
        }

        Difficulty d = ManualDifficultyOverride ? ManualDifficulty : PersistentData.Instance.Difficulty;

        if (!DifficultySettings.TryGetValue(d, out activeDifficultySettings))
        {
            Debug.LogError("The current difficulty (" + PersistentData.Instance.Difficulty.ToString() +
                           ") does not have a TracingDifficultySettings associated with it.");
        }

        finishTime = Time.time + 10f;
        GeneralSetup();
        //SetupLineRenderer();
        GetNecessaryPositions();
        SetupColliders();
    }
Example #11
0
    private void GameOver()
    {
        Countdown.onComplete -= GameOver;

        var tmpGrade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints());

        PointsManager.onFinishLeveling += () =>
        {
            brickSpawnmanager.Upgrade(tmpGrade);
            PointsManager.gameObject.SetActive(false);
            qualityText.text  = Quality.GradeToString(tmpGrade);
            qualityText.color = Quality.GradeToColor(tmpGrade);
            qualityText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(tmpGrade), 1f, 1f, 0f, false, 0f);
        };

        feedbackParticleSystem.GetComponent <ParticleSystem>().Stop();

        PointsManager.DoEndGameTransition();
        FollowSphere.SetActive(false);
        _currentRuneSprite.SetActive(false);
        ResetOptimalPoints();

        grade = Quality.CalculateCombinedQuality(GameManager.Instance.QualityTransfer, tmpGrade);
        ShowUIButtons();
        _dataBase.HideUI();
        _canTrace = false;
    }
Example #12
0
 public override void Selected()
 {
     if (Main.isDemo && !this._thingBag.GetOrDefault <bool>("isInDemo", false))
     {
         return;
     }
     if (this._placement)
     {
         if (!(Level.current is Editor current))
         {
             return;
         }
         current.placementType = this._thing;
         current.CloseMenu();
         SFX.Play("lowClick", 0.3f);
     }
     else
     {
         if (this._owner == null)
         {
             return;
         }
         this._owner.Selected((ContextMenu)this);
     }
 }
Example #13
0
    public override Tween Arrive(bool animate = true)
    {
        Tween t = base.Arrive(animate);

        if (GameManager.Instance.PlayerInfos.Count <= 0)
        {
            return(t);
        }

        PlayerInfo winner = GameManager.Instance.PlayerInfos[0];

        foreach (PlayerInfo player in GameManager.Instance.PlayerInfos)
        {
            if (player.AggregatePoints > winner.AggregatePoints)
            {
                winner = player;
            }
        }

        AvatarImage.sprite = winner.Avatar.Sprite;
        PointsText.text    = string.Format("{0:N0} points", winner.AggregatePoints);
        WinnerText.text    = string.Format("Player {0} is the WINNER!!!", winner.Index + 1);

        SFX.Play("winner_announce");

        return(t);
    }
    public void PlayRelevantQualitySFX(Quality.QualityGrade grade)
    {
        Debug.Log("Playing grade sound " + grade);
        switch (grade)
        {
        case Quality.QualityGrade.Junk:
            SFX.Play("Game_Quality_Junk", 1f, 1f, 0f, false, 0f);
            break;

        case Quality.QualityGrade.Brittle:
            SFX.Play("Game_Quality_Brittle", 1f, 1f, 0f, false, 0f);
            break;

        case Quality.QualityGrade.Passable:
            SFX.Play("Game_Quality_Passable", 1f, 1f, 0f, false, 0f);
            break;

        case Quality.QualityGrade.Sturdy:
            SFX.Play("Game_Quality_Sturdy", 1f, 1f, 0f, false, 0f);
            break;

        case Quality.QualityGrade.Magical:
            SFX.Play("Game_Quality_Magical", 1f, 1f, 0f, false, 0f);
            break;

        case Quality.QualityGrade.Mystic:
            SFX.Play("Game_Quality_Mystic", 1f, 1f, 0f, false, 0f);
            break;
        }
    }
Example #15
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            if (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal)
            {
                return(false);
            }

            var particleEnd =
                hitPos
                + (bullet.travelDirNormalized * bullet.bulletSpeed
                   * 3)
                + new Vec2(Rando.Float(-5f, 5f), Rando.Float(-5f, 5f));

            for (int i2 = 0; i2 < 3; i2++)
            {
                Level.Add(DotParticle.New(
                              hitPos.x + Rando.Float(-2f, 2f),
                              hitPos.y + Rando.Float(-2f, 2f),
                              () => particleEnd,
                              bullet.color.Add(new Color(
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15)
                                                   )),
                              0.2f));
            }
            SFX.Play("scimiSurge", 0.8f, Rando.Float(-0.2f, 0.2f));
            return(true);
        }
Example #16
0
        protected virtual void Explosion()
        {
            SFX.Play(Mod.GetPath <EdoMod>("SFX\\shootingstars"), looped: true);
            // IList<Duck> duckList = new List<Duck>();
            foreach (PhysicsObject physicsObject in Level.CheckCircleAll <PhysicsObject>(position, 96f))
            {
                if (Level.CheckLine <Block>(position, physicsObject.position, physicsObject) == null)
                {
                    if (physicsObject.owner == null)
                    {
                        Fondle(physicsObject);
                    }
                    Vec2 propulsion = (physicsObject.position - position).normalized * 6f;
                    physicsObject.hSpeed = propulsion.x;
                    physicsObject.vSpeed = propulsion.y;

                    if (physicsObject is Duck)
                    {
                        Level.Add(new StarDuckHandler(physicsObject as Duck, 60 * (int)(15.366f * 2f), showDaze: true));
                    }

                    /*
                     * RagdollPart ragdollPart = physicsObject as RagdollPart;
                     * if (ragdollPart != null && ragdollPart._doll != null && ragdollPart._doll._duck != null && !duckList.Contains(ragdollPart._doll._duck))
                     * {
                     *  Level.Add(new StunHandler(ragdollPart._doll._duck, 120, showDaze: true));
                     *  duckList.Add(ragdollPart._doll._duck);
                     * }
                     */
                }
            }
        }
    private void CheckIfOverPortal()
    {
        //Continue to raycast to check if it is over entry portal
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit secondHit;
        int        layerMask = LayerMask.GetMask("MinePortal");

        if (Physics.Raycast(ray, out secondHit, 10, layerMask))
        {
            if (!overPortal)
            {
                SFX.Play("Portal_sipping", 1.5f, 1f, 0f, true, 0f);
                overPortal = true;
            }
        }
        //Really dirty but need a way to prevent the sound being constantly initiated.
        else
        {
            if (overPortal)
            {
                overPortal = false;
                SFX.StopSpecific("Portal_sipping");
            }
        }
    }
Example #18
0
 private void Explode()
 {
     Explosion.Create(this, position);
     Level.Remove(this);
     SFX.Play(DuckUtils.GetAsset("sounds/vote_end.wav"));
     Playing = false;
 }
Example #19
0
 public override void Update()
 {
     base.Update();
     if (_first)
     {
         _loadProgress = 1f;
         _loadWait     = 0f;
     }
     if (!(_loadWait > 0f))
     {
         if (_loadProgress == 0f)
         {
             SFX.Play("shotgunLoad", 0.7f, -0.8f);
         }
         if (_loadProgress == 0.5f)
         {
             Reload();
         }
         _loadWait = 0f;
         if (_loadProgress < 1f)
         {
             _loadProgress += 0.1f;
             return;
         }
         _loadProgress = 1f;
         _first        = false;
     }
 }
Example #20
0
    public override void Update(float deltaTime)
    {
        if (character.stateCurrent != "jump")
        {
            return;
        }

        if (!character.input.GetButtons(buttonsDropDash))
        {
            character.AnimatorPlay("Roll");
            dropDashTimer = Mathf.Infinity;
        }

        if (character.input.GetButtonsDownPreventRepeat(buttonsDropDash))
        {
            dropDashTimer = 0.33333F;
        }

        if (character.input.GetButtons(buttonsDropDash) && dropDashTimer > 0)
        {
            dropDashTimer -= deltaTime;

            if (dropDashTimer <= 0)
            {
                SFX.Play(character.audioSource, "sfxDropDashCharge");
                character.AnimatorPlay("Drop Dash");
            }
        }
    }
Example #21
0
    void Start()
    {
        //Debug.Log(gameObject.name);
        SFX.Play("CraftingOre", looping: true);
        SFX.Play("fire_loop", looping: true);
        if (GameManager.Instance.ActiveGameMode == GameMode.Story)
        {
            Countdown.onComplete += GameOver;
        }
        else if (GameManager.Instance.ActiveGameMode == GameMode.Party)
        {
            Countdown.onComplete += GameOverParty;
        }

        Difficulty d = ManualDifficultyOverride ? ManualDifficulty : PersistentData.Instance.Difficulty;

        if (!DifficultySettings.TryGetValue(d, out activeDifficultySettings))
        {
            Debug.LogError("The current difficulty (" + PersistentData.Instance.Difficulty.ToString() +
                           ") does not have a SmeltingDifficultySettings associated with it.");
        }

        rb           = Dial.GetComponent <Rigidbody>();
        prevRotation = Dial.transform.localEulerAngles;
    }
Example #22
0
    // Use this for initialization
    void Start()
    {
        SFX.Play("game_instrumental", looping: true);

        if (BuildMockData)
        {
            PartyHelper.InsertMockPlayers();
            PartyHelper.InsertMockHistory();
            PartyHelper.InsertMockQueue();
        }

        // Game has not been initialized, probably starting from the editor with mock data disabled.
        if (GameManager.Instance.RoundQueue == null || GameManager.Instance.RoundHistory == null || GameManager.Instance.PlayerInfos == null)
        {
            Debug.LogWarning("Game has not been initialised.  Probably starting from the editor without mock data enabled.");
            return;
        }

        if (GameManager.Instance.RoundQueue.Count <= 0)
        {
            PseudoSceneManager.ChangeSceneWithoutAnimation("FinalScores");
            // If the round has ended and a new round is about to begin.
        }
        else if (GameManager.Instance.RoundHistory.First != null &&
                 GameManager.Instance.RoundHistory.First.Value.RoundNumber !=
                 GameManager.Instance.RoundQueue.Peek().RoundNumber)
        {
            PseudoSceneManager.ChangeSceneWithoutAnimation("Intermission");
        }
        else
        {
            PseudoSceneManager.ChangeSceneWithoutAnimation("RoundView");
        }
    }
Example #23
0
 public override void Update()
 {
     if (!this._cornerInit)
     {
         this._topLeft     = this.topLeft;
         this._topRight    = this.topRight;
         this._bottomLeft  = this.bottomLeft;
         this._bottomRight = this.bottomRight;
         this._cornerInit  = true;
     }
     if (Level.CheckRect <Duck>(this._topLeft - new Vec2(18f, 0.0f), this._bottomRight + new Vec2(18f, 0.0f)) != null)
     {
         this._desiredOpen = 1f;
     }
     else if (Level.CheckRect <PhysicsObject>(new Vec2(this.x - 4f, this.y - 24f), new Vec2(this.x + 4f, this.y + 8f)) == null)
     {
         this._desiredOpen = 0.0f;
     }
     if ((double)this._desiredOpen > 0.5 && !this._opened)
     {
         this._opened = true;
         SFX.Play("slideDoorOpen", 0.6f);
     }
     if ((double)this._desiredOpen < 0.5 && this._opened)
     {
         this._opened = false;
         SFX.Play("slideDoorClose", 0.6f);
     }
     this._open            = Maths.LerpTowards(this._open, this._desiredOpen, 0.15f);
     this._sprite.frame    = (int)((double)this._open * 32.0);
     this._collisionSize.y = (float)((1.0 - (double)this._open) * 32.0);
 }
Example #24
0
 public void ControlDuck(Duck d)
 {
     if ((double)this._canConvert > 0.00999999977648258 || d.dead || (!(this.owner is Duck owner) || owner == d))
     {
         return;
     }
     this._controlled  = true;
     owner.resetAction = true;
     ++d.profile.stats.timesMindControlled;
     this._controlledDuck = d;
     if (Network.isActive)
     {
         owner.Fondle((Thing)d);
         owner.Fondle((Thing)this._controlledDuck.holdObject);
         foreach (Equipment equipment in this._controlledDuck._equipment)
         {
             owner.Fondle((Thing)equipment);
         }
         owner.Fondle((Thing)this._controlledDuck._ragdollInstance);
         owner.Fondle((Thing)this._controlledDuck._trappedInstance);
         owner.Fondle((Thing)this._controlledDuck._cookedInstance);
     }
     this._controlledDuck.resetAction  = true;
     this._controlledDuck.mindControl  = owner.inputProfile;
     this._controlledDuck.controlledBy = owner;
     owner.immobilized = true;
     SFX.Play("radioNoise", 0.8f);
     Event.Log((Event) new MindControlEvent(this.responsibleProfile, d.profile));
     if (Recorder.currentRecording == null)
     {
         return;
     }
     Recorder.currentRecording.LogBonus();
 }
Example #25
0
    private void GameLoop()
    {
        // If it's time to spawn another cut.
        if (timeIntervalCounter > Mathf.Lerp(activeDifficultySettings.InitialSpawnInterval,
                                             activeDifficultySettings.EndSpawnInterval,
                                             activeDifficultySettings.SpawnCurve.Evaluate(timeCounter / CountdownObj.StartTime)) &&
            CutPrefab.SpawnTime < CountdownObj.CurrentTimeRemaining)
        {
            // TODO: maybe add a parent to keep the scene clean.
            var         cutPosition = GenerateNewCutPosition();
            NewCutPoint clone       = Instantiate(CutPrefab, cutPosition, Quaternion.identity, cutContainer.transform);
            // TODO: this is a bit messy, move GemObject calculation somewhere else.
            clone.CutVector          = -(cutPosition - GemSpawnManager.Gem.transform.position) * 1.8f;  // make the vector a bit longer.
            clone.onSpawnComplete   += cut => activeCuts.AddLast(cut);
            clone.onTimeoutComplete += cut => activeCuts.Remove(cut);
            SFX.Play("Cutting_circle_appears");

            timeIntervalCounter = 0;
        }

        // If player is struggling, show instructions again.
        if (missDurationCounter > MissDurationTimeout)
        {
            missDurationCounter = 0;
            InstructionManager.PushInstruction();
        }

        timeIntervalCounter += Time.deltaTime;
        timeCounter         += Time.deltaTime;
        missDurationCounter += Time.deltaTime;
    }
Example #26
0
 void OnTriggerEnter2D()
 {
     Bank.Instance.IncrementMoney(Value);
     SFX.Play(CollectedClip);
     Destroy(gameObject);
     Collected.Invoke();
 }
    private void Strike()
    {
        Collider2D []   hit           = new Collider2D[10];
        ContactFilter2D contactFilter = new ContactFilter2D();
        int             hits          = attackCollider.OverlapCollider(contactFilter, hit);

        if (hits > 0)
        {
            for (int i = 0; i < hits; i++)
            {
                IBattable battable = hit [i].GetComponent <IBattable> ();
                if (battable != null)
                {
                    Vector2 force = (hit[i].attachedRigidbody.position - (Vector2)transform.position).normalized * batPower;
                    battable.Push(force);

                    if (battable is Enemy)
                    {
                        int pointsGotten = GameManager.instance.enemyController.GetPoints((battable as Enemy).index);
                        if (pointsGotten > 0)
                        {
                            ui.Points += pointsGotten;
                        }
                    }
                }
            }
        }
        SFX.Play(batSwingClip);
        StartCoroutine(displayAttack());
    }
Example #28
0
 public override void Update()
 {
     base.Update();
     if (!this.destroyed && !this._stuck)
     {
         if (!this.burning && Level.CheckCircle <SmallFire>(this.position, 8f) != null)
         {
             this.burning = true;
             this.onFire  = true;
             Level.Add((Thing)SmallFire.New(0.0f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), firedFrom: ((Thing)this)));
             SFX.Play("ignite", Rando.Float(0.9f, 1f), Rando.Float(-0.2f, 0.2f));
         }
         this._sprite.frame = 0;
         this.angleDegrees  = -Maths.PointDirection(Vec2.Zero, new Vec2(this.hSpeed, this.vSpeed));
     }
     if (this._stuck)
     {
         this.vSpeed         = 0.0f;
         this.hSpeed         = 0.0f;
         this.grounded       = true;
         this._sprite.frame  = 1;
         this._stickTime    -= 0.01f;
         this.gravMultiplier = 0.0f;
     }
     if ((double)this._stickTime > 0.0 || this.destroyed)
     {
         return;
     }
     this.Destroy((DestroyType) new DTFade());
 }
Example #29
0
 public override void Quack(float volume, float pitch)
 {
     if (playing == null)
     {
         playing = SFX.Play(Mod.GetPath <EdoMod>("SFX\\bleep_ss"), volume, pitch, 0f, true);
     }
 }
    private void SellItem(Item item, Slot slot)
    {
        switch (item.GetType().ToString())
        {
        case "Gem":
            Inventory.Instance.AddGold(10);
            break;

        case "Jewel":
            Inventory.Instance.AddGold(20);
            break;

        case "Ore":
            Inventory.Instance.AddGold(10);
            break;

        case "Brick":
            Inventory.Instance.AddGold(20);
            break;

        case "ChargedJewel":
            Inventory.Instance.AddGold(50);
            break;

        case "Shell":
            Inventory.Instance.AddGold(50);
            break;
        }
        Inventory.Instance.RemoveItem(slot.index);
        slot.RemoveItem();
        slot = null;
        SaveManager.SaveInventory();
        SFX.Play("Bin_item_goaway", 1f, 1f, 0f, false, 0f);
        canSelect = true;
    }