示例#1
0
        public static string GetObjectTypeShortName(GObjectType t)
        {
            switch (t)
            {
            case (GObjectType.Bridge): return("МСТ");

            case (GObjectType.Crossing): return("ПРЕ");

            case (GObjectType.DangerousPlace): return("ОПМ");

            case (GObjectType.DeadEnd): return("ТПК");

            case (GObjectType.GpuSaut): return("ГПУ");

            case (GObjectType.Platform): return("ПЛФ");

            case (GObjectType.Station): return("СТЦ");

            case (GObjectType.Switch): return("СТР");

            case (GObjectType.Tks): return("ТКС");

            case (GObjectType.TrafficLight): return("СВФ");

            case (GObjectType.Tunnel): return("ТНЛ");

            default: return(t.ToString());
            }
        }
示例#2
0
 protected override void FillWithBytes(byte[] Data)
 {
     Type     = (GObjectType)Data[0];
     Length   = SubInt(Data, 1, 2);
     Ordinate = SubInt(Data, 7, 3);
     AlsnFreq = AlsnFromCode(Data[6]);
     Name     = Encoding.GetEncoding(1251).GetString(Data, 10, 8).Trim();
 }
示例#3
0
 public GObject(int Ordinate, int Length, GObjectType Type, string Name, AlsnFrequency AlsnFreq, int SpeedRestriction)
 {
     this.Ordinate         = Ordinate;
     this.Length           = Length;
     this.AlsnFreq         = AlsnFreq;
     this.Name             = Name;
     this.SpeedRestriction = SpeedRestriction;
     this.Type             = Type;
 }
示例#4
0
        private static string GetObjectTypeShortName(GObjectType t)
        {
            switch (t)
            {
            case GObjectType.Bridge:
                return("МСТ");

            case GObjectType.Crossing:
                return("ПРЕ");

            case GObjectType.DangerousPlace:
                return("ОПМ");

            case GObjectType.DeadEnd:
                return("ТПК");

            case GObjectType.GpuSaut:
                return("ГПУ");

            case GObjectType.Platform:
                return("ПЛФ");

            case GObjectType.Station:
                return("СТЦ");

            case GObjectType.Switch:
                return("СТР");

            case GObjectType.Tks:
                return("ТКС");

            case GObjectType.TrafficLight:
                return("СВФ");

            case GObjectType.Tunnel:
                return("ТНЛ");

            case GObjectType.Unknown:
                return("НЗВ");

            default:
                return(t.ToString());
            }
        }
示例#5
0
 public static string GetObjectTypeShortName(GObjectType t)
 {
     switch (t)
     {
         case (GObjectType.Bridge): return "МСТ";
         case (GObjectType.Crossing): return "ПРЕ";
         case (GObjectType.DangerousPlace): return "ОПМ";
         case (GObjectType.DeadEnd): return "ТПК";
         case (GObjectType.GpuSaut): return "ГПУ";
         case (GObjectType.Platform): return "ПЛФ";
         case (GObjectType.Station): return "СТЦ";
         case (GObjectType.Switch): return "СТР";
         case (GObjectType.Tks): return "ТКС";
         case (GObjectType.TrafficLight): return "СВФ";
         case (GObjectType.Tunnel): return "ТНЛ";
         default: return t.ToString();
     }
 }
示例#6
0
 protected override void FillWithBytes(byte[] Data)
 {
     Type = (GObjectType)Data[0];
     Length = SubInt(Data, 1, 2);
     Ordinate = SubInt(Data, 7, 3);
     AlsnFreq = AlsnFromCode(Data[6]);
     Name = Encoding.GetEncoding(1251).GetString(Data, 10, 8).Trim();
 }
示例#7
0
    /*
     * Function: Setup
     *
     * -Sets up the GameObject this script is attached to. That is:
     *      -Adds controllers, components or child GameObjects to this GameObject, which are specific to each GObjectType
     *      -Initializes added controllers/components.
     */
    void Setup(GObjectType obj_type)
    {
        ActorController controller;
        GameObject      parts;

        switch (obj_type)
        {
        case GObjectType.Player:

            // add PlayerController
            controller = linked_gobject.renderedGameObject.AddComponent <PlayerController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.characterAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent <CharBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent <CharBodyController> ());
            break;

        case GObjectType.Character:

            // add CharacController
            controller = linked_gobject.renderedGameObject.AddComponent <CharacController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.characterAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent <CharBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent <CharBodyController> ());
            break;

        case GObjectType.Animal:

            // add AnimalController
            controller = linked_gobject.renderedGameObject.AddComponent <AnimalController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.animalAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent <AnimalBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent <AnimalBodyController> ());
            break;

        case GObjectType.Structure:

            // add GeneralObjectController
            StructureController ctrl = linked_gobject.renderedGameObject.AddComponent <StructureController> ();
            addedComponents.Add(ctrl);

            // add sprite renderer
            Component sprite_renderer = linked_gobject.renderedGameObject.AddComponent <SpriteRenderer> ();
            addedComponents.Add(sprite_renderer);

            ctrl.linkGObject(linked_gobject);
            ctrl.Init();                        // sets sprite
            break;
        }
    }
示例#8
0
    /*
     * Function: Setup
     *
     * -Sets up the GameObject this script is attached to. That is:
     * 		-Adds controllers, components or child GameObjects to this GameObject, which are specific to each GObjectType
     * 		-Initializes added controllers/components.
     */
    void Setup(GObjectType obj_type)
    {
        ActorController controller;
        GameObject parts;

        switch(obj_type) {

        case GObjectType.Player:

            // add PlayerController
            controller = linked_gobject.renderedGameObject.AddComponent<PlayerController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.characterAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent<CharBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent<CharBodyController> ());
            break;

        case GObjectType.Character:

            // add CharacController
            controller = linked_gobject.renderedGameObject.AddComponent<CharacController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.characterAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent<CharBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent<CharBodyController> ());
            break;

        case GObjectType.Animal:

            // add AnimalController
            controller = linked_gobject.renderedGameObject.AddComponent<AnimalController> ();
            addedComponents.Add(controller);

            // add bodypart structure hierarchy
            parts = Instantiate(GameRenderer.GRenderer.rObject.animalAnimStructure) as GameObject;
            addedGameObjects.Add(parts);

            parts.transform.parent = linked_gobject.renderedGameObject.transform;
            parts.GetComponent<AnimalBodyController> ().Init(linked_gobject);
            controller.linkActor((GActor)linked_gobject, parts.GetComponent<AnimalBodyController> ());
            break;

        case GObjectType.Structure:

            // add GeneralObjectController
            StructureController ctrl = linked_gobject.renderedGameObject.AddComponent<StructureController> ();
            addedComponents.Add(ctrl);

            // add sprite renderer
            Component sprite_renderer = linked_gobject.renderedGameObject.AddComponent<SpriteRenderer> ();
            addedComponents.Add(sprite_renderer);

            ctrl.linkGObject(linked_gobject);
            ctrl.Init ();		// sets sprite
            break;

        }
    }