Пример #1
0
    public void LockCell(string arg)
    {
        PrisonCell cell = FindCell(arg);

        if (cell != null)
        {
            cell.close();
        }
    }
Пример #2
0
    public void OpenCell(string arg)
    {
        PrisonCell cell = FindCell(arg);

        if (cell != null)
        {
            cell.open();
        }
    }
Пример #3
0
        public static PrisonCell Generate(HallWay previous, Cardinal buildingDirection, Vector2Int startPos, int level)
        {
            PrisonCell cell = new PrisonCell()
            {
                parent    = previous,
                position  = startPos,
                direction = buildingDirection,
                depth     = previous.Depth,
                width     = UnityEngine.Random.Range(3, 5),
                height    = UnityEngine.Random.Range(2, 5)
            };

            return(cell);
        }
Пример #4
0
    private void Init()
    {
        List <IMyTerminalBlock> rotors = new List <IMyTerminalBlock>();

        grid.SearchBlocksOfName("Cell", rotors,
                                delegate(IMyTerminalBlock block) {
            return(block is IMyMotorStator && Util.NameRegex(block, CellPattern).Success);
        });

        program.Echo("initialized with " + rotors.Count + " rotors");
        for (int n = 0; n < rotors.Count; n++)
        {
            PrisonCell p = new PrisonCell(this, rotors[n] as IMyMotorStator);
            prisons[p.id] = p;
        }
    }
    public void TransportSuspectToOpenCell()
    {
        //if (suspect.Find("ID").GetComponent<IDCharacter>()) {
        //    IDCharacter ident = suspect.Find("ID").GetComponent<IDCharacter>();

        //    suspect.GetComponent<Collider>().enabled = false;
        //    suspect.GetComponent<Rigidbody>().isKinematic = true;

        //    if (ident.arrestable) {
        //        PrisonCell openCell = RetrieveAvailableCell();
        //        if (openCell != null) {
        //            suspect.parent = null;
        //            suspect.position = openCell.arrivalLocation.position;

        //            suspect.GetComponent<Collider>().enabled = true;
        //            suspect.GetComponent<Rigidbody>().isKinematic = false;
        //        }
        //    }
        //}

        if (currentSuspect != null)
        {
            Transform susp = currentSuspect.GetSelf();

            //if (susp.GetComponent<Collider>() != null) { susp.GetComponent<Collider>().enabled = false; }
            //if (susp.GetComponent<Rigidbody>() != null) { susp.GetComponent<Rigidbody>().isKinematic = true; }

            PrisonCell openCell = RetrieveAvailableCell();
            if (openCell != null)
            {
                prisonCage.position = openCell.arrivalLocation.position;
                susp.SetParent(null);

                if (susp.GetComponent <Collider>() != null)
                {
                    susp.GetComponent <Collider>().enabled = true;
                }
                if (susp.GetComponent <Rigidbody>() != null)
                {
                    susp.GetComponent <Rigidbody>().isKinematic = false;
                }
            }
        }
    }
Пример #6
0
    public PrisonCell FindCell(string arg)
    {
        System.Text.RegularExpressions.Match m = (new System.Text.RegularExpressions.Regex(IDPattern)).Match(arg);
        if (!m.Success)
        {
            program.Echo("No Prison called [" + arg + "] found");
            return(null);
        }

        int    rotor   = int.Parse(m.Groups[1].Value);
        string chamber = m.Groups[2].Value;

        program.Echo("should have a cell " + rotor + " -> " + chamber);
        PrisonCell cell = prisons[rotor];

        cell.requestedChamber = chamber;

        return(cell);
    }