Beispiel #1
0
 public ConstructionJob(Vector3 jobSite, MaterialType matType, MaterialItem mat, ConstrucatbleItem itemToConstruct) : base(jobSite)
 {
     this.jobSite         = jobSite;                             //[TEMP HARD CODED JOBSITE]
     this.matType         = matType;
     materialForJob       = mat;
     this.itemToConstruct = itemToConstruct;
 }
 private void Construct(ConstrucatbleItem thing)                                 //Construct an item
 {
     if (thing == ConstrucatbleItem.Wall)
     {
         GameObject newWallgo = new GameObject();                               //create Gameobject
         newWallgo.AddComponent <SpriteRenderer>();                             //add sprite renderer
         newWallgo.transform.Rotate(-90, 0, 0);                                 //Rotate upwards
         StructuralWall newWall = newWallgo.AddComponent <StructuralWall>();    //add wal script
         newWall.SetWallMaterial(currConstJob.getSetMaterialForJob.mat);        //call set materiual method on wall
         newWallgo.transform.position = TileManager._instance.getTileFromWorldPoint(currConstJob.getJobsite).gameObject.transform.position;
         //snap to position of tile it sits on
     }
 }