//-Implementation private void Awake() { _sprite = XUtils.getComponent <SpriteRenderer>( gameObject, XUtils.AccessPolicy.ShouldExist ); _collider = XUtils.getComponent <BoxCollider2D>( gameObject, XUtils.AccessPolicy.ShouldExist ); XUtils.getComponent <MouseAttachComponent>( gameObject, XUtils.AccessPolicy.ShouldBeCreated ).onMouseMove += (Vector2 inMousePosition) => { updateColor(); }; XUtils.getComponent <MouseClickTrackingComponent>( gameObject, XUtils.AccessPolicy.ShouldBeCreated ).onClick += () => { if (!isPossibleToBuild()) { return; } ConstructionSiteObject theConstructionSite = createConstructionSite(); getUIInterface().processConstructionStart(theConstructionSite); Destroy(gameObject); }; }
public void processConstructionStart( ConstructionSiteObject inConstructionSite) { var theWorldObjectsAttachedUIManager = FindObjectOfType <WorldObjectsAttachedUIManger>(); ConstructionSiteUIObject theConstructionSiteUI = XUtils.createObject(XUtils.verify(_constructionSiteUIPrefab)); theConstructionSiteUI.init(_carCity, inConstructionSite); theWorldObjectsAttachedUIManager.attach( theConstructionSiteUI.gameObject, inConstructionSite.gameObject ); }
public ConstructionSiteObject createConstructionSite() { XUtils.check(isPossibleToBuild()); ConstructionSiteObject theConstructionSite = XUtils.createObject( getBuildingScheme().constructionSite, transform ); theConstructionSite.init(_carCity); theConstructionSite.transform.SetParent(transform.parent, true); theConstructionSite.gameObject.layer = gameObject.layer; return(theConstructionSite); }
public void setConstruction(ConstructionSiteObject inConstruction) { _construction = inConstruction; }
//Methods //-API public void init(CarCityObject inCarCity, ConstructionSiteObject inConstructionSite) { _carCity = XUtils.verify(inCarCity); _constructionSite = XUtils.verify(inConstructionSite); }