Ejemplo n.º 1
0
 void SetRndProbs(HumanProperties probs)
 {
     //TODO: macht nicht viel Sinn oder? Sprit muss angepasst werden
     probs.sex    = RandomInt(0, 1) == 0 ? SexEnum.male : SexEnum.female;
     probs.age    = Random.Range(5, 99);
     probs.status = HealthStatusEnum.healthy;
 }
Ejemplo n.º 2
0
    public HumanProperties SpawnObject(GameObject preFab)
    {
        Vector2    pos = new Vector2(Random.Range(-maxRangeX / 2, maxRangeX / 2) + transform.position.x, Random.Range(-maxRangeY / 2, maxRangeY / 2) + transform.position.y);
        GameObject h   = GameObject.Instantiate(preFab);

        h.transform.position = pos;
        HumanProperties probs = h.GetComponent <HumanProperties>();

        return(probs);
    }
Ejemplo n.º 3
0
 public static bool TrySelectNewCharacter(HumanProperties vHumanProperties)
 {
     if (SelectedCharacter == null)
     {
         SelectedCharacter = vHumanProperties;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
    void Start()
    {
        SetSpeed(normalSpeed);

        //Calc init move dir
        calcDir(Random.Range(0, 360));

        myProbs = GetComponent <HumanProperties>();

        Highlighter.SetActive(false);
        DirectionArrow.SetActive(false);

        InvokeRepeating("NewRandomDirection", 2.0f, RandomDirectionCycleTime);
    }
Ejemplo n.º 5
0
    public void AddNewInfected(HumanProperties human)
    {
        if (isGameOver)
        {
            return;
        }

        //check if already  counted
        if (infectedHumans.Contains(human))
        {
            return;
        }

        Debug.Log("New!");
        infectedHumans.Add(human);

        CheckLost();
    }
Ejemplo n.º 6
0
    // Start is called before the first frame update
    void Start()
    {
        List <HumanProperties> allHumans = new List <HumanProperties>();

        for (int i = 0; i < count; i++)
        {
            GameObject      preFab = humans[RandomInt(0, humans.Count)];
            SpawnPoint      point  = spawnPoints[RandomInt(0, spawnPoints.Count)];
            HumanProperties probs  = point.SpawnObject(preFab);

            SetRndProbs(probs);
            allHumans.Add(probs);
        }

        //failsave - need min 1 infected
        InfectionManager.Instance.setAllHumans(allHumans);
        if (InfectionManager.Instance.infectedHumans.Count <= startInfected)
        {
            for (int i = 0; i < startInfected; i++)
            {
                allHumans[i].Infect();      //infect
            }
        }
    }
Ejemplo n.º 7
0
 public Human()
 {
     Properties = new HumanProperties();
 }
Ejemplo n.º 8
0
 public void addHuman(HumanProperties newHuman)
 {
     allHumans.Add(newHuman);
 }
Ejemplo n.º 9
0
 public static void DeselectCharacter()
 {
     SelectedCharacter = null;
 }