// --------------------------------------------------------------------------------------------------------------------- // Private methods // --------------------------------------------------------------------------------------------------------------------- #region // Initialization. private void Start() { // Get health. this.health=this.GetComponent<HazardHealth>(); // Set random angular speed (remember to set 'AngularDrag' in inspector to 0 - turns off resist of angular velocity). this.GetComponent<Rigidbody>().angularVelocity = Random.insideUnitSphere * this.angular_speed; // Set vertical velocity. this.GetComponent<Rigidbody>().velocity = new Vector3(Random.Range(-0.3F,0.3F),0.0F,-1.0F) * this.vert_velocity; } // End of Start
// --------------------------------------------------------------------------------------------------------------------- // Private methods // --------------------------------------------------------------------------------------------------------------------- #region // Initialization. private void Start() { // Get rigitbody. this.rbdy=this.GetComponent<Rigidbody>(); // Get audio source. this.audio_source = this.GetComponent<AudioSource>(); // Get projectiles parent. this.projectiles_parent=GameObject.FindGameObjectWithTag("projectiles").transform; // Get health. this.health=this.GetComponent<HazardHealth>(); // Set boundries. BoundriesSet(); // Get initial target x. this.init_target_x = this.transform.position.x; // Set velocity. this.GetComponent<Rigidbody>().velocity = Vector3.back * this.ship_speed_vert; // Fire. InvokeRepeating("Fire",this.wait_time_before_first_fire,this.weapon_type.fire_rate); // Start dodge coroutine. StartCoroutine(Dodge()); } // End of Start