コード例 #1
0
    //-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);
        };
    }
コード例 #2
0
    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
            );
    }
コード例 #3
0
    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);
    }
コード例 #4
0
ファイル: CrewMember.cs プロジェクト: AlexTagun/Xelon
 public void setConstruction(ConstructionSiteObject inConstruction)
 {
     _construction = inConstruction;
 }
コード例 #5
0
 //Methods
 //-API
 public void init(CarCityObject inCarCity, ConstructionSiteObject inConstructionSite)
 {
     _carCity          = XUtils.verify(inCarCity);
     _constructionSite = XUtils.verify(inConstructionSite);
 }