Inheritance: MonoBehaviour
Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (StressManager.GetBurnout())
        {
            max_timer = (new_max_timer * 0.6f) + 0.125f;
        }
        else
        {
            max_timer = new_max_timer;
        }
        //when timer reaches 0 spawn an instance of obstacle or item at randomised spawner pos;
        timer -= Time.deltaTime;
        if (timer <= 0.0f)
        {
            timer        = max_timer;
            last_spawner = chooseSpawner(last_spawner);
            Vector3 position = spawners[last_spawner].transform.position;

            GameObject spawn;
            if (pickup_counter == 0)
            {
                pickup_counter = pickup_rate;
                spawn          = prefabs[1];
            }
            else
            {
                spawn = prefabs[0];
            }

            Instantiate(spawn, position, Quaternion.identity);
            pickup_counter--;
        }
    }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage"/> class.
        /// </summary>
        public MainPage()
        {
            this.InitializeComponent();

            StressType[] stressOpts = { StressType.Default, StressType.Service, StressType.Client };
            StressTypeComboBox.DataContext   = stressOpts;
            StressTypeComboBox.SelectedIndex = 0;

            this.stressManager = new StressManager(this);
            this.stressManager.CurrentlyRunning = false;
        }
 private void OnTouchUp()
 {
     if (!StressManager.GetBurnout())
     {
         if (StressManager.GetResting())
         {
             StressManager.SetResting(false);
             Debug.Log(StressManager.GetResting().ToString());
         }
         else // Not Resting
         {
             StressManager.SetResting(true);
             Debug.Log(StressManager.GetResting().ToString());
         }
     }
 }
    void OnTriggerStay(Collider collider)
    {
        if (stressManagerObject == null)
        {
            stressManagerObject = GameObject.FindWithTag("client");
            stressManager       = stressManagerObject.GetComponent <StressManager>();
        }

        if (collider.gameObject.tag == "zone1")
        {
            stressManager.SlowStressIncrease(power);
        }
        else
        {
            stressManager.onExitZoneStress();
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (StressManager.GetBurnout())
     {
         if (Burned.color.a < 1.0f)
         {
             Burned.color = new Color(Burned.color.r, Burned.color.g, Burned.color.b, Burned.color.a + (Time.deltaTime * 2));
         }
     }
     else
     {
         if (Burned.color.a > 0.0f)
         {
             Burned.color = new Color(Burned.color.r, Burned.color.g, Burned.color.b, Burned.color.a - (Time.deltaTime * 2));
         }
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (StressManager.GetResting())
     {
         if (Serenity.color.a < 1.0f)
         {
             Serenity.color = new Color(Serenity.color.r, Serenity.color.g, Serenity.color.b, Serenity.color.a + (Time.deltaTime * 2));
         }
     }
     else
     {
         if (Serenity.color.a > 0.0f)
         {
             Serenity.color = new Color(Serenity.color.r, Serenity.color.g, Serenity.color.b, Serenity.color.a - (Time.deltaTime * 2));
         }
     }
 }
Example #7
0
 private void OnTriggerEnter(Collider other)
 {
     if (health != 0)
     {
         if (other.tag == "Obstacle" && !invincible)
         {
             gameObject.GetComponent <AudioSource>().Play();
             Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation);
             gameObject.GetComponent <SpriteRenderer>().color = Color.red;
             Destroy(other.gameObject);
             health--;
             invincible = true;
             if (health == 0)
             {
                 invincibility_timer = 4.5f;
                 score -= 50;
                 Instantiate(score_effect, gameObject.transform.position, gameObject.transform.rotation).GetComponent <TextMesh>().text = "-50";
             }
             else
             {
                 score -= 25;
                 Instantiate(score_effect, gameObject.transform.position, gameObject.transform.rotation).GetComponent <TextMesh>().text = "-25";
             }
             if (!StressManager.GetBurnout() && !StressManager.GetResting())
             {
                 StressManager.IncreaseStressLevel(FindObjectOfType <StressTimerScript>().maxStress / 4);
             }
         }
         else if (other.tag == "Pickup")
         {
             Destroy(other.gameObject);
             if (health < 3)
             {
                 health++;
             }
             score += 20;
             Instantiate(score_effect, gameObject.transform.position, gameObject.transform.rotation).GetComponent <TextMesh>().text = "+20";
             GetComponent <Spawner>().SpawnBodyPart();
             if (!StressManager.GetBurnout() && !StressManager.GetResting())
             {
                 StressManager.DecreaseStressLevel(FindObjectOfType <StressTimerScript>().maxStress / 5);
             }
         }
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (!StressManager.GetResting() && !StressManager.GetBurnout())
     {
         if (StressManager.GetStressLevel() < maxStress)
         {
             StressManager.IncreaseStressLevel(Time.deltaTime);
             stressBar.fillAmount = StressManager.GetStressLevel() / maxStress;
         }
         else
         {
             Debug.Log("BURNOUT");
             StressManager.SetBurnout(true);
             Debug.Log(StressManager.GetBurnout().ToString());
         }
     }
     else
     {
         if (StressManager.GetResting())
         {
             if (StressManager.GetStressLevel() > 0)
             {
                 StressManager.DecreaseStressLevel(Time.deltaTime * restRecoverySpeed);
                 stressBar.fillAmount = StressManager.GetStressLevel() / maxStress;
             }
             else
             {
                 StressManager.SetResting(false);
             }
         }
         else if (StressManager.GetBurnout())
         {
             if (StressManager.GetStressLevel() > 0)
             {
                 StressManager.DecreaseStressLevel(Time.deltaTime * burnoutRecoverySpeed);
                 stressBar.fillAmount = StressManager.GetStressLevel() / maxStress;
             }
             else
             {
                 StressManager.SetBurnout(false);
             }
         }
     }
 }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        if (StressManager.GetBurnout())
        {
            speed = max_speed * 1.6f;
        }
        else
        {
            speed = max_speed;
        }
        //move downwards and delete if reach the bottom
        Vector3 pos = gameObject.transform.position;

        pos.y -= speed * Time.deltaTime;
        gameObject.transform.position = pos;

        if (pos.y <= -6)
        {
            Destroy(gameObject);
        }
    }
Example #10
0
 //This allocates the variable office with the main stress script component.
 public void Start()
 {
     breakRoom = breakManager.GetComponent<StressManager> ();
 }
Example #11
0
 void Awake()
 {
     instance = this;
 }
Example #12
0
 protected void InitializeStressManager(StressManager stressManager)
 {
     this.baseStressManager = stressManager;
 }
Example #13
0
 //This allocates the variable office with the main stress script component.
 public void Start()
 {
     office = officeManager.GetComponent<StressManager> ();
 }
Example #14
0
	// Use this for initialization
	void Start () {
		Stats = GameObject.Find ("_Gm").GetComponent<stats> ();
		stressMan = GameObject.Find ("_Gm").GetComponent<StressManager> ();

		
	}