示例#1
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++;
                    SteamWorker.SetStat("stat_notes_read", playerData.Notes);
                    if (SteamWorker.GetStat("stat_notes_read") == playerData.Notes)
                    {
                        SteamWorker.IndicateAchievementProgress("cheevo_notes", (uint)playerData.Notes.Value, (uint)totalNotes);
                    }
                }
            }, this.IsCollected));
        }
示例#2
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++;
                    SteamWorker.SetStat("stat_orbs_collected", playerData.Collectibles);
                    if (SteamWorker.GetStat("stat_orbs_collected") == playerData.Collectibles)
                    {
                        SteamWorker.IndicateAchievementProgress("cheevo_orbs", (uint)playerData.Collectibles.Value, (uint)totalCollectibles);
                    }

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

                    this.main.Menu.HideMessage
                    (
                        WorldFactory.Instance,
                        this.main.Menu.ShowMessageFormat(WorldFactory.Instance, "\\orbs collected", collected, total),
                        4.0f
                    );
                }
            };
        }