コード例 #1
0
        void AC_Died(AttributesComponent obj)
        {
            EC.RemoveWeapons();

            AudioManager.PlaySoundEffect(DyingSound);
            var deaded = DyingComponent.CreateDyingEntity(this.Parent, DyingSprite, DyingDuration);

            if (!CorvusGame.Instance.SceneManager.ActiveScene.Name.Contains("Arena")) //TODO: Better remember to change this if we need to.
            {
                deaded.GetComponent <DyingComponent>().OnDyingAnimationFinished += PlayerControlComponent_OnDyingAnimationFinished;
            }

            obj.Parent.Dispose();
        }
コード例 #2
0
        void AC_Died(AttributesComponent obj)
        {
            //Drop coins
            int c      = CoinsValue;
            int gold   = (c < 5) ? 0 : c /= 5;
            int silver = (c < 3) ? 0 : c /= 3;
            int bronze = c;

            for (int i = 0; i < gold; i++)
            {
                GenerateCoinEntity("Coin_Gold", 2f - ((float)i) / 10);
            }
            for (int i = 0; i < silver; i++)
            {
                GenerateCoinEntity("Coin_Silver", 1.5f - ((float)i) / 10);
            }
            for (int i = 0; i < bronze; i++)
            {
                GenerateCoinEntity("Coin_Bronze", 1f - ((float)i) / 10);
            }
            AudioManager.PlaySoundEffect("CoinDrop");

            //Give exp.
            //CorvBase.Instance.Players
            foreach (var p in CorvBase.Instance.Players)
            {
                var pcp = p.Character.GetComponent <PlayerControlComponent>();
                pcp.CurrentExperience += AwardedExperience;
            }

            //play sound
            AudioManager.PlaySoundEffect(DyingSound);

            var deaded = DyingComponent.CreateDyingEntity(this.Parent, DyingSprite, DyingDuration);

            deaded.GetComponent <DyingComponent>().OnDyingAnimationFinished += DestroyableObjectComponent_OnDyingAnimationFinished;

            obj.Parent.Dispose();
        }