Example #1
0
    // Use this for initialization
    void Start()
    {
        ResourceInfo.setFoodStock(100);
        ResourceInfo.setWaterStock(100);
        ResourceInfo.setWoodStock(100);
        campEvents = new List <CampEvent>(EventSystem.GetCampEvents(0, 20, 10));
        eventTiles = new List <GameObject>(EventSystem.GetEventTiles(0, 20, 10));
        Weather weather = EventSystem.GetWeather(0);

        foreach (CampEvent ce in campEvents)
        {
            Debug.Log("Camp Event Message: \"" + ce.message
                      + "\"\nFood Effect: " + ce.food
                      + "\nWater Effect: " + ce.water
                      + "\nWood Effect: " + ce.wood);
        }
        foreach (GameObject go in eventTiles)
        {
            EventTile et = go.GetComponent <EventTile>();
            EncounterCharacterEvent ece = (EncounterCharacterEvent)et.tileEvent;
            Debug.Log("Event Name: \""
                      + ece.name + "\"\nDescription: "
                      + ece.description + "\nDialog: "
                      + ece.encounterDialog + "\nCharacter Name: "
                      + ece.character.name + "\nHostile?: "
                      + ece.character.isHostile + "\nmaxHealth: "
                      + ece.character.getMaxHealth() + "\nmaxStamina: "
                      + ece.character.getMaxStamina() + "\nmaxStrength: "
                      + ece.character.getMaxStrength());
        }
        Debug.Log(weather.ToString());
    }
    public static EncounterCharacterEvent GenerateRandom()
    {
        float random = UnityEngine.Random.value;
        EncounterCharacterEvent result = new EncounterCharacterEvent();

        result.character       = Character.GenerateRandom(random);
        result.name            = (result.character.isHostile) ? "Engard!" : "Stranger danger!";
        result.description     = "You've encountered someone in the wasteland.";
        result.encounterDialog = (result.character.isHostile) ? TextReader.GetDialog("Hostile") : TextReader.GetDialog("Nonhostile");
        return(result);
    }
Example #3
0
    static public List <GameObject> GetEventTiles(int day, int maxEvents = 20, int minEvents = 0)
    {
        UnityEngine.Random.InitState(day);
        int               numEvents       = Math.Max(minEvents, (int)(maxEvents * UnityEngine.Random.value));
        GameObject        eventTilePrefab = (GameObject)Resources.Load("Prefabs/EventTile");
        List <GameObject> result          = new List <GameObject>(numEvents);

        for (int i = 0; i < numEvents; ++i)
        {
            result.Add(UnityEngine.Object.Instantiate(eventTilePrefab));
            result[i].GetComponent <EventTile>().tileEvent = EncounterCharacterEvent.GenerateRandom();
        }
        return(result);
    }
    // Use this for initialization
    void Start()
    {
        //after i push this, max carry wont work.... bc of naming of eventtiles
        eventTile                 = GameObject.Find("Test1");
        eventTileScript           = eventTile.GetComponent <EventTile>();
        eventTileScript.tileEvent = EncounterCharacterEvent.GenerateRandom();

        /*
         * eventTile2 = GameObject.Find("Test2");
         * eventTileScript2 = eventTile2.GetComponent<EventTile>();
         * eventTileScript2.tileEvent = EncounterCharacterEvent.GenerateRandom();
         */

        fuq = eventTileScript.tileEvent.character;
        if (fuq == null)
        {
            Debug.Log("whattehfuckishap");
        }

        Debug.Log(eventTileScript.tileEvent.character.name);
        Debug.Log("Hostile = " + eventTileScript.tileEvent.character.isHostile);
        Debug.Log(eventTileScript.tileEvent.description);
        //Debug.Log(eventTileScript2.tileEvent.description);
    }
 // Use this for initialization
 void Start()
 {
     thisNPC     = gameObject.GetComponent <EventTile>().tileEvent;
     npcAnimator = gameObject.GetComponent <Animator> ();
 }