public override Activity Tick( Actor self )
        {
            if (started)
            {
                // Don't break the actor if someone has overriden the animation prematurely
                if (rb.anim.CurrentSequence.Name != "make")
                {
                    complete = true;
                    OnComplete();
                }
                return complete ? NextActivity : this;
            }

            started = true;
            rb = self.Trait<RenderBuilding>();
            if (Reversed)
            {
                // TODO: These don't belong here
                var bi = self.Info.Traits.GetOrDefault<BuildingInfo>();
                if (bi != null)
                    foreach (var s in bi.SellSounds)
                        Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);

                rb.PlayCustomAnimBackwards(self, "make", () => { OnComplete(); complete = true;});
            }
            else
                rb.PlayCustomAnimThen(self, "make", () => { OnComplete(); complete = true;});

            return this;
        }
示例#2
0
 public Transform(Actor self, string toActor, int2 offset, int facing, string[] sounds)
 {
     this.actor = toActor;
     this.offset = offset;
     this.sounds = sounds;
     this.facing = facing;
     rb = self.TraitOrDefault<RenderBuilding>();
 }
示例#3
0
 public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info)
     : base(init.self, info)
 {
     this.info            = info;
     turret               = turrets.FirstOrDefault();
     rb                   = init.self.Trait <RenderBuilding>();
     skippedMakeAnimation = init.Contains <SkipMakeAnimsInit>();
 }
示例#4
0
 public HarvesterDockSequence(Actor self, Actor proc)
 {
     this.proc = proc;
     state = State.Turn;
     harv = self.Trait<Harvester>();
     rb = proc.Trait<RenderBuilding>();
     startDock = self.Trait<IHasLocation>().PxPosition;
     endDock = proc.Trait<IHasLocation>().PxPosition + new int2(-15,8);
 }
示例#5
0
        public override Activity Tick(Actor self)
        {
            if (self.IsDead())
            {
                return(NextActivity);
            }

            if (started)
            {
                // Don't break the actor if someone has overriden the animation prematurely
                if (rb.DefaultAnimation.CurrentSequence.Name != "make")
                {
                    complete = true;
                    OnComplete();
                }
                return(complete ? NextActivity : this);
            }

            started = true;
            rb      = self.Trait <RenderBuilding>();
            if (Reversed)
            {
                // TODO: These don't belong here
                var bi = self.Info.Traits.GetOrDefault <BuildingInfo>();
                if (bi != null)
                {
                    foreach (var s in bi.SellSounds)
                    {
                        Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
                    }
                }

                rb.PlayCustomAnimBackwards(self, "make", () => { OnComplete(); complete = true; });
            }
            else
            {
                rb.PlayCustomAnimThen(self, "make", () => { OnComplete(); complete = true; });
            }

            return(this);
        }
        public WithDeliveryAnimation(Actor self, WithDeliveryAnimationInfo info)
        {
            building = self.Trait <RenderBuilding>();

            this.info = info;
        }