예제 #1
0
        public override void Awake()
        {
            base.Awake();

#if STEAMWORKS
            this.LeaderboardSync.Action = this.syncLeaderboard;
#endif

            this.EnabledWhenPaused = false;

            this.Retry.Action = this.retry;

            this.Add(new CommandBinding(this.Disable, delegate()
            {
                this.main.BaseTimeMultiplier.Value = 0.0f;
                this.main.Menu.CanPause.Value      = false;
            }));

            this.Add(new CommandBinding(this.main.Spawner.PlayerSpawned, delegate()
            {
                PlayerFactory.Instance.Add(new CommandBinding(PlayerFactory.Instance.Get <Player>().Die, (Action)this.retryDeath));
            }));

            this.BestTime.Value = this.main.GetMapTime(WorldFactory.Instance.Get <World>().UUID);

            this.Add(new CommandBinding(this.Disable, delegate()
            {
                AkSoundEngine.PostEvent(AK.EVENTS.STOP_ALL, this.Entity);
                AkSoundEngine.PostEvent(AK.EVENTS.PLAY_MUSIC_STINGER, this.Entity);
                this.BestTime.Value = this.main.SaveMapTime(WorldFactory.Instance.Get <World>().UUID, this.ElapsedTime);
                PlayerFactory.Instance.Get <FPSInput>().Enabled.Value = false;
                SteamWorker.IncrementStat("stat_challenge_levels_played", 1);
            }));
        }
예제 #2
0
        public override void Awake()
        {
            base.Awake();
            Note.notes.Add(this);
            this.Add(new NotifyBinding(delegate()
            {
                if (this.IsCollected)
                {
                    int notesCollected = Note.notes.Where(x => x.IsCollected).Count();
                    int total          = Note.notes.Count;

                    Container msg = this.main.Menu.ShowMessageFormat
                                    (
                        this.Entity,
                        "\\notes read",
                        notesCollected, total
                                    );
                    this.main.Menu.HideMessage(this.Entity, msg, 4.0f);
                    this.Collected.Execute();
                    PlayerData playerData = PlayerDataFactory.Instance.Get <PlayerData>();
                    playerData.Notes.Value++;
                    if (playerData.Notes >= totalNotes)
                    {
                        SteamWorker.SetAchievement("cheevo_notes");
                    }
                    SteamWorker.IncrementStat("notes_read", 1);
                }
            }, this.IsCollected));
        }
예제 #3
0
        public override void Awake()
        {
            base.Awake();
            Collectible.collectibles.Add(this);

            this.PlayerTouched.Action = delegate
            {
                if (!this.PickedUp)
                {
                    this.PickedUp.Value = true;
                    AkSoundEngine.PostEvent(AK.EVENTS.PLAY_COLLECTIBLE, this.Entity);
                    float originalGamma      = main.Renderer.InternalGamma.Value;
                    float originalBrightness = main.Renderer.Brightness.Value;
                    this.Entity.Add
                    (
                        new Animation
                        (
                            new Animation.FloatMoveTo(main.Renderer.InternalGamma, 10.0f, 0.2f),
                            new Animation.FloatMoveTo(main.Renderer.InternalGamma, originalGamma, 0.4f)
                        )
                    );

                    PlayerData playerData = PlayerDataFactory.Instance.Get <PlayerData>();
                    playerData.Collectibles.Value++;
                    if (playerData.Collectibles >= totalCollectibles)
                    {
                        SteamWorker.SetAchievement("cheevo_orbs");
                    }

                    int collected = Collectible.collectibles.Count(x => x.PickedUp);
                    int total     = Collectible.collectibles.Count;

                    SteamWorker.IncrementStat("orbs_collected", 1);

                    this.main.Menu.HideMessage
                    (
                        WorldFactory.Instance,
                        this.main.Menu.ShowMessageFormat(WorldFactory.Instance, "\\orbs collected", collected, total),
                        4.0f
                    );
                }
            };
        }
예제 #4
0
파일: TimeTrial.cs 프로젝트: tammukul/Lemma
        public override void Awake()
        {
            base.Awake();

            this.EnabledWhenPaused = false;
            this.Enabled.Value     = false;

            this.Retry.Action = this.retry;

            if (!this.AllowRespawn)
            {
                this.Add(new CommandBinding(this.main.Spawner.PlayerSpawned, delegate()
                {
                    PlayerFactory.Instance.Add(new CommandBinding(PlayerFactory.Instance.Get <Player>().Die, (Action)this.retryDeath));
                }));
            }

            this.BestTime.Value = this.main.GetMapTime(WorldFactory.Instance.Get <World>().UUID);

            this.Add(new CommandBinding(this.Disable, delegate()
            {
                this.main.BaseTimeMultiplier.Value = 0.0f;
                this.main.Menu.CanPause.Value      = false;
                AkSoundEngine.PostEvent(AK.EVENTS.STOP_ALL, this.Entity);
                AkSoundEngine.PostEvent(AK.EVENTS.PLAY_MUSIC_STINGER, this.Entity);
                this.BestTime.Value = this.main.SaveMapTime(WorldFactory.Instance.Get <World>().UUID, this.ElapsedTime);
                PlayerFactory.Instance.Get <FPSInput>().Enabled.Value = false;
                this.ShowUI.Execute();
#if STEAMWORKS
                SteamWorker.IncrementStat("stat_challenge_levels_played", 1);
                string uuid = WorldFactory.Instance.Get <World>().UUID;
                int score   = (int)(this.BestTime.Value * 1000.0f);
                this.Proxy.Sync(uuid, score);
#endif
            }));
        }
예제 #5
0
        public override void Awake()
        {
            base.Awake();
            Collectible.collectibles.Add(this);

            this.PlayerTouched.Action = delegate
            {
                if (!this.PickedUp)
                {
                    this.PickedUp.Value = true;
                    AkSoundEngine.PostEvent(AK.EVENTS.PLAY_COLLECTIBLE, this.Entity);
                    float originalGamma      = main.Renderer.InternalGamma.Value;
                    float originalBrightness = main.Renderer.Brightness.Value;
                    this.Entity.Add
                    (
                        new Animation
                        (
                            new Animation.FloatMoveTo(main.Renderer.InternalGamma, 10.0f, 0.2f),
                            new Animation.FloatMoveTo(main.Renderer.InternalGamma, originalGamma, 0.4f),
                            new Animation.Execute(this.Entity.Delete)
                        )
                    );

                    int collectibles = ++PlayerDataFactory.Instance.Get <PlayerData>().Collectibles.Value;

                    SteamWorker.IncrementStat("orbs_collected", 1);

                    this.main.Menu.HideMessage
                    (
                        WorldFactory.Instance,
                        this.main.Menu.ShowMessageFormat(WorldFactory.Instance, collectibles == 1 ? "\\one orb collected" : "\\orbs collected", collectibles),
                        4.0f
                    );
                }
            };
        }