예제 #1
0
 public override void SetBasement(SurfaceBlock b, PixelPosByte pos)
 {
     if (b == null)
     {
         return;
     }
     PrepareHouse(b, pos);
     if (level > 3)
     {
         if (rooftop == null)
         {
             rooftop = Instantiate(Resources.Load <GameObject>("Structures/HQ_rooftop"));
             rooftop.transform.parent        = transform.GetChild(0);
             rooftop.transform.localPosition = Vector3.up * (level - 3) * Block.QUAD_SIZE;
         }
         if (level > 4)
         {
             int i = 5;
             while (i <= level)
             {
                 b.myChunk.BlockByStructure(b.pos.x, (byte)(b.pos.y + i - 4), b.pos.z, this);
                 GameObject addon = Instantiate(Resources.Load <GameObject>("Structures/HQ_Addon"));
                 addon.transform.parent        = transform.GetChild(0);
                 addon.transform.localPosition = Vector3.zero + (i - 3.5f) * Vector3.up * Block.QUAD_SIZE;
                 addon.transform.localRotation = transform.GetChild(0).localRotation;
                 i++;
             }
             BoxCollider bc = transform.GetChild(0).GetComponent <BoxCollider>();
             bc.center = Vector3.up * (level - 3) * Block.QUAD_SIZE / 2f;
             bc.size   = new Vector3(Block.QUAD_SIZE, (level - 3) * Block.QUAD_SIZE, Block.QUAD_SIZE);
         }
     }
     colony = GameMaster.colonyController;
     colony.SetHQ(this);
 }
예제 #2
0
    public override void SetBasement(Plane b, PixelPosByte pos)
    {
        if (b == null)
        {
            return;
        }
        colony = GameMaster.realMaster.colonyController;
        if (colony == null)
        {
            colony = GameMaster.realMaster.gameObject.AddComponent <ColonyController>();
            colony.Prepare();
        }
        colony.SetHQ(this);

        SetBuildingData(b, pos);
        maxHp = 1000 * level;
        hp    = maxHp;

        if (level > 3)
        {
            if (!GameMaster.loading)
            {
                SetBlockers();
            }
            else
            {
                if (!subscribedToRestoreBlockersEvent)
                {
                    GameMaster.realMaster.blockersRestoreEvent += RestoreBlockers;
                    subscribedToRestoreBlockersEvent            = true;
                }
            }
        }
    }