Example #1
0
    private BuildingObject createBuilding()
    {
        BuildingObject theBuilding = XUtils.createObject(
            getBuildingScheme().building, transform
            );

        theBuilding.init(_carCity);

        theBuilding.transform.SetParent(transform.parent, true);
        theBuilding.gameObject.layer = gameObject.layer;

        return(theBuilding);
    }
Example #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
            );
    }
Example #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);
    }
Example #4
0
    //--Shoot implementation
    private void performShootFromPoint(GameObject inShootingPoint)
    {
        Vector2 theRocketPosition = new Vector2();
        float   theRocketRotation = 0.0f;

        XMath.getFromTransform(
            ref theRocketPosition, ref theRocketRotation, inShootingPoint
            );

        RocketProjectileObject theRocket =
            XUtils.createObject(_projectilePrefab);

        theRocket.init(XUtils.verify(_owner));

        theRocket.transform.position = theRocketPosition;
        Vector3 theRotation = theRocket.transform.rotation.eulerAngles;

        theRotation.z = theRocketRotation;
        theRocket.transform.eulerAngles = theRotation;
    }
Example #5
0
    BuildingSelectionUIElementObject createBuildingSelectionUI(
        BuildingScheme inBuildingSceme)
    {
        GameObject theBuildingSelectionUIGameObject =
            Instantiate(_buildingSelectionUIElementPrefab);
        var theBuildingSelectionUI =
            XUtils.getComponent <BuildingSelectionUIElementObject>(
                theBuildingSelectionUIGameObject, XUtils.AccessPolicy.ShouldExist
                );

        theBuildingSelectionUI.init(inBuildingSceme,
                                    (BuildingScheme inBuildingScheme) =>
        {
            BuildingPlanObject theBuildingPlan = XUtils.createObject(
                inBuildingScheme.buildingPlan
                );
            theBuildingPlan.init(_carCity);
            theBuildingPlan.getUIInterface().init(
                _carCity, _constructionSiteUIPrefab
                );
        });

        return(theBuildingSelectionUI);
    }