Beispiel #1
0
    private void TryToShutDoor(Door door)
    {
        PowerStory    powerStory    = storiesHelper.Get <PowerStory>();
        SwitchesStory switchesStory = storiesHelper.Get <SwitchesStory>();

        // Door can't be closed if there's no power or the door lock switch is on
        if (powerStory.remainingPower <= 0 || switchesStory.IsSwitchOn(door))
        {
            return;
        }


        isDoorOpen[door] = false;
    }
Beispiel #2
0
    void HandleNextEnemyTurn(Enemy enemy)
    {
        Location      currentLocation = characterLocations[enemy];
        SwitchesStory switchesStory   = storiesHelper.Get <SwitchesStory>();

        if (switchesStory.doesLocationContainAvailableSwitch(currentLocation) && Random.Range(0, 99) > SwitchActivationPercentage)
        {
            TriggerDoorSwitch(enemy, currentLocation);
        }
        else
        {
            MoveEnemy(enemy, currentLocation);
        }
    }
    void MapStoriesToProps(Story story)
    {
        SwitchesStory switchesStory = story.Get <SwitchesStory>();
        SwitchStory   switchStory   = switchesStory.GetStory(location);
        SwitchState   state         = switchStory.state;


        if (state == SwitchState.OFF)
        {
            gameObject.GetComponent <SpriteRenderer>().sprite = switchOffSprite;
        }
        else
        {
            gameObject.GetComponent <SpriteRenderer>().sprite = switchOnSprite;
        }
        // SwitchStory switchStory =
        // Dictionary<Enemy, Location> characterLocations= story.Get<EnemyPositionStory>().characterLocations;
        // Text text = GetComponent<Text>();

        // text.text = enemy.ToString() + ":" +characterLocations[enemy].ToString();
    }