public void UpdateSelf(Construction _construction)
    {
        RemoveSelfFromTile();
        myConstruction = _construction;
        myData         = myConstruction.myData;
        isConstruction = true;

        /*if (isSpaceLanding)
         *      GetComponentInChildren<SpriteGraphicsController>().DoSpaceLanding(null);*/

        myRend = GetComponentInChildren <SpriteGraphicsController>();
        GenericUpdateSelf(myConstruction.locations, _construction.center);
        if (myConstruction.isConstruction)
        {
            myRend.SetBuildState(SpriteGraphicsController.BuildState.construction);
        }
        else
        {
            myRend.SetBuildState(SpriteGraphicsController.BuildState.destruction);
        }


        myInventory      = myConstruction.constructionInventory;
        isInventorySetup = true;
        buildingInventoryUpdatedCallback?.Invoke();
        StopAnimations();
    }
Beispiel #2
0
    public void UpdateSelf(Position _location, Belt _belt)
    {
        RemoveSelfFromTile();
        myBelt         = _belt;
        direction      = myBelt.direction;
        isConstruction = false;


        /*if (isSpaceLanding)
         *      GetComponentInChildren<SpriteGraphicsController>().DoSpaceLanding(null);*/


        myRend = GetComponentInChildren <SpriteGraphicsController>();
        GenericUpdateSelf(_location);
        myRend.SetBuildState(SpriteGraphicsController.BuildState.built);
    }
Beispiel #3
0
    public void UpdateSelf(Position _location, Connector _connector)
    {
        RemoveSelfFromTile();
        myConnector    = _connector;
        direction      = myConnector.direction;
        isConstruction = false;

        /*if (isSpaceLanding)
         *      GetComponentInChildren<SpriteGraphicsController>().DoSpaceLanding(null);*/

        myRend = GetComponentInChildren <SpriteGraphicsController>();
        GenericUpdateSelf(_location);
        myRend.SetBuildState(SpriteGraphicsController.BuildState.built);

        myConnector.ConnectorInputsUpdatedCallback -= UpdateConnectorGraphics;
        myConnector.ConnectorInputsUpdatedCallback += UpdateConnectorGraphics;
        UpdateConnectorGraphics();
    }
Beispiel #4
0
    public void UpdateSelf(Position _location, Construction _construction)
    {
        RemoveSelfFromTile();
        myConstruction = _construction;
        direction      = myConstruction.direction;
        isConstruction = true;

        /*if (isSpaceLanding)
         *      GetComponentInChildren<SpriteGraphicsController>().DoSpaceLanding(null);*/

        myRend = GetComponentInChildren <SpriteGraphicsController>();
        GenericUpdateSelf(_location);
        if (myConstruction.isConstruction)
        {
            myRend.SetBuildState(SpriteGraphicsController.BuildState.construction);
        }
        else
        {
            myRend.SetBuildState(SpriteGraphicsController.BuildState.destruction);
        }
    }
    public void UpdateSelf(Building _building)
    {
        RemoveSelfFromTile();
        // Only update if the building has changed
        if (myBuilding != null && !myBuilding.center.isValid() && myBuilding.myPositions != null && myBuilding.myPositions.Count > 0 && myBuilding.myPositions[0] == _building.myPositions[0])
        {
            return;
        }

        myBuilding     = _building;
        myData         = _building.buildingData;
        isConstruction = false;


        /*if (isSpaceLanding)
         *      GetComponentInChildren<SpriteGraphicsController>().DoSpaceLanding(null);*/

        myRend = GetComponentInChildren <SpriteGraphicsController>();
        GenericUpdateSelf(myBuilding.myPositions, _building.center);
        myRend.SetBuildState(SpriteGraphicsController.BuildState.built);


        myCrafter = myBuilding.craftController;
        myCrafter.continueAnimationsEvent -= ContinueAnimations;
        myCrafter.continueAnimationsEvent += ContinueAnimations;
        myCrafter.stopAnimationsEvent     -= StopAnimations;
        myCrafter.stopAnimationsEvent     += StopAnimations;

        myInventory      = myBuilding.invController;
        isInventorySetup = true;
        buildingInventoryUpdatedCallback?.Invoke();
        StopAnimations();

        if (_building.buildingData.uniqueName == "bRocket" && !isSpaceLandingTriggered)
        {
            isSpaceLandingTriggered = true;
            GetComponentInChildren <SpriteGraphicsController>().DoSpaceLanding(null);
        }
    }
Beispiel #6
0
    void Start()
    {
        myRend = GetComponent <SpriteGraphicsController>();
        switch (myData.gfxType)
        {
        case BuildingData.BuildingGfxType.SpriteBased:
            myRend.SetGraphics(myData.gfxSprite, myData.gfxShadowSprite != null? myData.gfxShadowSprite : myData.gfxSprite);
            break;

        case BuildingData.BuildingGfxType.AnimationBased:
            myRend.SetGraphics(myData.gfxSpriteAnimation, myData.isAnimatedShadow);

            break;

        case BuildingData.BuildingGfxType.PrefabBased:
            myRend.SetGraphics(myData.gfxPrefab);
            break;
        }

        if (SpaceLanding)
        {
            _Landing();
        }
    }