Пример #1
0
 public void SendCommand()
 {
     if (subject)
     {
         subject.AddCommand(command);
     }
     else
     {
         GameUI.Instance.mapEditor.CreateHall(dir, nowCell);
     }
     ordering = false;
     terrainSelectionViewer.Clear();
     terrainSelectionViewer.Apply();
     terrainSelectionViewer.enabled = false;
 }
Пример #2
0
 public void sendOrder()
 {
     requested = false;
     switch (command.type)
     {
     case CommandType.BUILD:
         if (subject.Building)
         {
             //subject.AddCommand(new Command(CommandType.GETOUT));
             //subject.AddCommand(new Command(CommandType.MOVE, selectedCell));
             subject.AddCommand(command);
         }
         break;
     }
     cleared = true;
 }
Пример #3
0
    public void CreateHall(TriDirection dir, TriCell cell)
    {
        Hall ret = (Hall)CreateBuilding(dir, cell, (Building)TriIsland.GetBuildingPrefabs((int)BuildingType.HALL, (int)HallType.BASE, 0));

        if (ret)
        {
            TriIsland.Instance.entities.camp = ret;
            for (int i = 0; i < 4; i++)
            {
                Unit t = CreateUnit(ret.EntranceLocation, (Unit)TriIsland.GetUnitPrefabs((int)UnitType.PERSON, 0));
                ((Human)t).Home = null;
                t.AddCommand(new GetInCommand(ret));
            }
            ret.Working = true;
        }
    }
Пример #4
0
 public Unit CreateUnit(TriCell cell, Unit prefab)
 {
     if (cell)
     {
         Unit ret = Instantiate(prefab);
         ret.ID          = entities.UnitCount;
         ret.Location    = cell;
         ret.Orientation = Random.Range(0f, 360f);
         entities.AddUnit(ret);
         if (cell.Statics)
         {
             ret.AddCommand(new GetInCommand((Building)cell.Statics));
         }
         return(ret);
     }
     return(null);
 }
Пример #5
0
    public static Unit Load(BinaryReader reader)
    {
        UnitType       type        = (UnitType)reader.ReadInt32();
        float          orientation = reader.ReadSingle();
        bool           acting      = reader.ReadBoolean();
        List <Command> tCommand    = ListPool <Command> .Get();

        if (acting)
        {
            int count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                tCommand.Add(Command.Load(reader));
            }
        }
        Unit ret = null;

        switch (type)
        {
        case UnitType.PERSON:
            ret = Person.Load(reader);
            break;
        }
        if (ret)
        {
            ret.orientation = orientation;
            ret.type        = type;
            if (acting)
            {
                foreach (Command i in tCommand)
                {
                    ret.AddCommand(i);
                }
            }
        }
        tCommand.Clear();
        ListPool <Command> .Add(tCommand);

        return(ret);
    }