Esempio n. 1
0
    void OnCollisionEnter(Collision col)
    {
        double rand;
        double player1Value;
        double player2Value;

        if (col.gameObject.tag == "Slytherin")
        {
            Debug.Log("Slytherin on Slytherin Violence");
            rand = rng.NextDouble();
            if (rand >= 0.025)
            {
                CollisionUnconscious();
            }
        }
        else if (col.gameObject.tag == "Griffindor")
        {
            Debug.Log("Slytherin on Griffindor Violence");
            player1Value = aggressiveness * (rng.NextDouble() * (1.2 - 0.8) + 0.8) * (1 - (exhaustion / maxExhaustion));
            griff        = col.gameObject.GetComponent <GriffindorPlayer>();
            player2Value = griff.aggressiveness * (rng.NextDouble() * (1.2 - 0.8) + 0.8) * (1 - (griff.exhaustion / griff.maxExhaustion));
            if (player1Value < player2Value)
            {
                CollisionUnconscious();
            }
            else
            {
                griff.CollisionUnconscious();
            }
        }
    }
Esempio n. 2
0
    void CreateGriffindor()
    {
        float spawnPointX;

        teamGriffindor = new List <GameObject>();
        for (int i = 0; i < numPlayers; i++)
        {
            spawnPointX = griffindorStartPoint.x + i;
            GameObject griff = Instantiate(GriffindorPlayer, griffindorStartPoint + new Vector3(spawnPointX, 0f, 0f), Quaternion.identity);
            rig      = griff.GetComponent <Rigidbody>();
            rig.mass = (float)SampleGaussian(rng, gMeanWeight, gStddevWeight);
            GriffindorPlayer stats = griff.GetComponent <GriffindorPlayer>();
            stats.aggressiveness = SampleGaussian(rng, gMeanAggressiveness, gStddevAggressiveness);
            stats.maxExhaustion  = SampleGaussian(rng, gMeanMaxExhaustion, gStddevMaxExhaustion);
            stats.exhaustion     = 0;
            stats.maxSpeed       = SampleGaussian(rng, gMeanMaxVelocity, gStddevMaxVelocity);

            teamGriffindor.Add(griff);
        }
    }