示例#1
0
 private void PlayDamageSounds(planetSettings settings, GameObject planet)
 {
     planetSounds = planet.GetComponent<planetsIndividualSound>();
     if ((settings.population / settings.maxPopulation) < 0.333)
     {
         planetSounds.AudioDamaged();
     }
 }
示例#2
0
    public void KillPeople(GameObject planet)
    {
        settings = planet.GetComponent<planetSettings>();
        settings.population -= settings.maxPopulation * settings.flickUpDeathPercentage;

        if (settings.population < 0.0f)
            settings.population = 0.0f;
    }
    // Use this for initialization
    void Start()
    {
        planetAnim = transform.Find("planet_graphic").GetComponent<Animator>();
        glowAnim = transform.Find("glow_graphic").GetComponent<Animator>();
        elecOverAnim = transform.Find("elecOver_graphic").GetComponent<Animator>();
        elecUnderAnim = transform.Find("elecUnder_graphic").GetComponent<Animator>();
        holdAnim = transform.Find("hold_graphic").GetComponent<Animator>();
        hoverAnim = transform.Find("hover_graphic").GetComponent<Animator>();

        settings = GetComponent<planetSettings>();
    }
示例#4
0
 public void UpdateDeceaseCount()
 {
     double followers = 0;
     double population = 0;
     double dead = 0;
     for (int i = 0; i < planets.Length; i++)
     {
         settings = planets[i].GetComponent<planetSettings>();
         followers += (settings.population * settings.followers);
         population += settings.population;
         dead += (settings.maxPopulation - settings.population);
     }
     gameManager.Instance.followers = followers;
     gameManager.Instance.population = population;
     gameManager.Instance.dead = dead;
 }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        // bleed all planets
        for (int i = 0; i < planets.Length; i++)
        {
            planet = planets[i];
            settings = planet.GetComponent<planetSettings>();
            init = planet.GetComponent<planetInit>();

            // choose the bigger evil of hold/gravity
            float bleed = 1.0f;
            if (init.gravityBleedMultilier > bleed) bleed = init.gravityBleedMultilier;
            else if (init.bleedMultilier > bleed) bleed = init.bleedMultilier;

            if (init.do_kill_people && settings.population > 0.0f)
            {
                diffMagnitude = Mathf.Abs(init.initVelocity.magnitude - planet.GetComponent<Rigidbody2D>().velocity.magnitude);
                settings.population -= diffMagnitude * (settings.maxPopulation * settings.bleedPercentage * bleed) * Time.deltaTime;

                // planet dead
                if (settings.population < 0.0f)
                {
                    settings.population = 0.0f;
                }
            }

            PlayDamageSounds(settings, planet);
            UpdateDeceaseCount();
        }
    }
示例#6
0
    void Start()
    {
        UpdateTinker();

        // get settings
        planetSettings = GetComponent<planetSettings>();
        planetSettings.maxPopulation = planetSettings.population;
        initSpeed = planetSettings.speed * speedMult;
        orbitRadius = planetSettings.orbitRadius;

        if (randomiseInitialPosition)
        {
            posDiff = new Vector3(Random.Range(-1.0f,1.0f), Random.Range(-1.0f,1.0f), 0.0f);
        }
        else
        {
            posDiff = transform.localPosition;
        }
        posDiff = posDiff.normalized * (orbitRadius / 200);

        // setup physics
        HingeSetup();
        InitVelocity();
        ColliderSetup();
        IgnoreCollisions();
    }