Exemplo n.º 1
0
        protected override DereferenceResult Perform(BandInstrument.PlayBandInstrument <T> reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            ReferenceWrapper result;

            if (Matches(reference, "mJig", field, objects, out result) != MatchResult.Failure)
            {
                //Remove(ref reference.mJig );
                return(DereferenceResult.ContinueIfReferenced);
            }

            return(DereferenceResult.Failure);
        }
Exemplo n.º 2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim sim = Sim.CreatedSim;

            BandInstrument.PlayBandInstrument <TInstrument> interaction = sim.InteractionQueue.GetCurrentInteraction() as BandInstrument.PlayBandInstrument <TInstrument>;
            if (interaction != null)
            {
                int elapsedCalendarDays = SimClock.ElapsedCalendarDays();

                SimData data = GetData <SimData>(Sim);

                DateAndTime lastChange = data.mLast;
                lastChange.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours);

                if (lastChange > SimClock.CurrentTime())
                {
                    data.mLast = SimClock.CurrentTime();

                    interaction.TriggerAudio(false);

                    if (interaction.mInstrumentSound == null)
                    {
                        Sims3.Gameplay.Skills.Guitar.Composition PlayingComposition = null;

                        try
                        {
                            PlayingComposition = (interaction.mSkill as BandSkill).GetRandomComposition(false);
                        }
                        catch (Exception)
                        {
                            // If the known compositions is zero, GetRandom will except
                        }

                        if (PlayingComposition != null)
                        {
                            interaction.mInstrumentSound = new ObjectSound(interaction.Target.ObjectId, PlayingComposition.AudioClip);
                            interaction.mInstrumentSound.StartLoop();
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }