Exemple #1
0
        public override IEnumerable <Gizmo> SlaveGizmos()
        {
            // 1. Arm the collar
            var         armCollar = new Command_Toggle();
            Func <bool> isArmed   = () => armed;

            armCollar.isActive     = isArmed;
            armCollar.defaultLabel = "Label_CollarExplosive_Arm".Translate();
            armCollar.defaultDesc  = "Desc_CollarExplosive_Arm".Translate();
            armCollar.toggleAction = delegate {
                armed = !armed;
                if (armed)
                {
                    if (arm_cooldown == 0)
                    {
                        // Doesn't matter if pawn is slave or not when armed
                        SlaveUtility.TryInstantBreak(Wearer, Rand.Range(0.25f, 0.33f));
                        arm_cooldown = 2500;
                    }
                }
            };
            armCollar.activateSound = SoundDefOf.Click;
            armCollar.icon          = ContentFinder <Texture2D> .Get("UI/Commands/ArmCollar", true);

            yield return(armCollar);

            // 2. Detonate the collar
            if (armed)
            {
                var detonate = new Command_Action();
                detonate.defaultLabel = "Label_CollarExplosive_Detonate".Translate();
                detonate.defaultDesc  = "Desc_CollarExplosive_Detonate".Translate();
                detonate.action       = delegate {
                    GoBoom();
                };
                detonate.activateSound = SoundDefOf.Click;
                detonate.icon          = ContentFinder <Texture2D> .Get("UI/Commands/DetonateCollar", true);

                yield return(detonate);
            }
        }