Esempio n. 1
0
 void INotifyTeslaCharging.Charging(Actor self, Target target)
 {
     wsb.PlayCustomAnimation(self, info.ChargeSequence, () => wsb.CancelCustomAnimation(self));
 }
Esempio n. 2
0
        void ITick.Tick(Actor self)
        {
            switch (state)
            {
            case TechBunkerState.ClosedLocked:
                if (timer++ >= info.UnlockAfter && self.World.SharedRandom.Next(0, info.UnlockChance) == 0)
                {
                    state = TechBunkerState.ClosedUnlocked;
                    timer = 0;
                }

                break;

            case TechBunkerState.ClosedUnlocked:
                var nearbyActors = self.World.FindActorsInCircle(self.CenterPosition, info.TriggerRadius).Where(actor => !actor.Owner.NonCombatant)
                                   .ToArray();
                if (!nearbyActors.Any())
                {
                    return;
                }

                var owner = nearbyActors[self.World.SharedRandom.Next(0, nearbyActors.Length - 1)].Owner;

                state = TechBunkerState.Opening;

                wsb.PlayCustomAnimation(self, info.SequenceOpening, () =>
                {
                    state = TechBunkerState.Opened;
                    wsb.PlayCustomAnimationRepeating(self, info.SequenceOpened);

                    EjectContents(self, owner);
                });

                if (info.SoundOpen != null)
                {
                    Game.Sound.Play(SoundType.World, info.SoundOpen.Random(self.World.SharedRandom), self.CenterPosition);
                }
                break;

            case TechBunkerState.Opened:
                if (self.World.WorldActor.Trait <TechBunkerBehavior>().Behavior == TechBunkerBehaviorType.Reusable && info.LockAfter != -1 &&
                    timer++ >= info.LockAfter)
                {
                    state = TechBunkerState.Closing;
                    timer = 0;

                    wsb.PlayCustomAnimationBackwards(self, info.SequenceOpening, () =>
                    {
                        state = TechBunkerState.ClosedLocked;
                        wsb.CancelCustomAnimation(self);
                    });

                    if (info.SoundClose != null)
                    {
                        Game.Sound.Play(SoundType.World, info.SoundClose.Random(self.World.SharedRandom), self.CenterPosition);
                    }
                }

                break;
            }
        }
Esempio n. 3
0
 void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
 {
     wsb.PlayCustomAnimation(self, info.SequenceFire);
 }