Beispiel #1
0
    void Start()
    {
        gameStateStory = storiesHelper.Get <GameStateStory>();

        if (!created)
        {
            created = true;
            storiesHelper.Dispatch(TimedActionsStory.AddTimedActiontFactory.Get(EnemyPositionStory.NextEnemyTurnFactory.Get(), 2, true));
            storiesHelper.Dispatch(TimedActionsStory.AddTimedActiontFactory.Get(PowerStory.CalculateUsageFactory.Get(), 1, true));
            storiesHelper.Dispatch(TimedActionsStory.AddTimedActiontFactory.Get(TimeStory.UpdateTimeFactory.Get(), 1, true));
            storiesHelper.Dispatch(GameStateStory.SetGameStateFactory.Get(GameState.PLAYING));
        }
    }
    void Start()
    {
        background = GameObject.Find("RoomBackground").GetComponent <SpriteRenderer>();
        cam        = Camera.main;

        bgCentre = background.transform.position.x;
        float bgWidth = background.bounds.extents.x;
        float bgRight = bgCentre + bgWidth;
        float bgLeft  = bgCentre - bgWidth;

        float camVertExtent = cam.orthographicSize;
        float camWidth      = cam.aspect * camVertExtent;
        float camCentre     = cam.transform.position.x;

        maxCamRight    = bgRight - camWidth;
        minCamLeft     = bgLeft + camWidth;
        gameStateStory = storiesHelper.Get <GameStateStory>();
    }
    void MapStoriesToProps(Story story)
    {
        GameStateStory gameStateStory = story.Get <GameStateStory>();

        switch (gameStateStory.gameState)
        {
        case GameState.LOST:
            textField.text = "Game Lost";
            break;

        case GameState.WON:
            textField.text = "Game Won";
            break;

        default:
            textField.text = "";
            break;
        }
    }