Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     //initalizes references to components, and sets enabled to false so the enemy does not charge until it is seen by the camera.
     rb2d          = GetComponent <Rigidbody2D>();
     go            = GameObject.Find("MainCharacter");
     MainCharacter = (Movescript)go.GetComponent(typeof(Movescript));
     AudioSource   = GameObject.Find("EnemyDiedAudio");
     enabled       = false;
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     //Gets a reference the the rigidbody, which contains physics functions
     rb2d = GetComponent <Rigidbody2D>();
     //freeze rotation
     rb2d.freezeRotation = true;
     //pull a reference to the main character so it can damage it.
     go            = GameObject.Find("MainCharacter");
     MainCharacter = (Movescript)go.GetComponent(typeof(Movescript));
     //pull a reference to the death sound audio so it can play it.
     AudioSource = GameObject.Find("EnemyDiedAudio");
 }
Ejemplo n.º 3
0
    /*
     * Mode 0: Finding the Charge
     * Mode 1: Charging:
     * Mode 2: Returning:
     */

    // Start is called before the first frame update
    void Start()
    {
        //make sure the boss doesn't move before it is seen by the player.
        enabled = false;
        //get references to components and game objects
        rb2d                  = GetComponent <Rigidbody2D>();
        go                    = GameObject.Find("MainCharacter");
        MainCharacter         = (Movescript)go.GetComponent(typeof(Movescript));
        start_position.x      = this.transform.position.x;
        start_position.y      = this.transform.position.y;
        AudioSource           = GameObject.Find("EnemyDiedAudio");
        SpawnedAudioSource    = GameObject.Find("SpawnedEnemyAudio");
        TookDamageAudioSource = GameObject.Find("BossDamageAudio");
    }
Ejemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     //get a reference to the main character so its components can be called
     rb2d = GetComponent <Rigidbody2D>();
     go   = GameObject.Find("MainCharacter");
     //get a reference to the enemydiedaudio so it can be played later
     AudioSource = GameObject.Find("EnemyDiedAudio");
     //get a reference to movescript so the maincharacter can be damaged
     MainCharacter = (Movescript)go.GetComponent(typeof(Movescript));
     //by default enemies with seekscript will not start moving unless they are visible to the camera.
     //the spawned enemy by the boss does not follow this restriction however, which is what the start_moving parameter is for
     enabled = false;
     if (start_moving)
     {
         enabled = true;
     }
 }
Ejemplo n.º 5
0
 void save(string name)
 {
     //create a save file containing the scene name and the health total.
     if (File.Exists(path))
     {
         File.Delete(path);
     }
     using (FileStream fs = File.Create(path))
     {
         byte[] info = new UTF8Encoding(true).GetBytes(name);
         fs.Write(info, 0, info.Length);
         movescript = (Movescript)maincharacter.GetComponent(typeof(Movescript));
         byte[] newline = Encoding.ASCII.GetBytes(System.Environment.NewLine);
         fs.Write(newline, 0, newline.Length);
         string health_string = movescript.get_health().ToString();
         info = new UTF8Encoding(true).GetBytes(health_string);
         fs.Write(info, 0, info.Length);
         //  print(name + "saved!");
     }
 }
Ejemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     rb2d          = GetComponent <Rigidbody2D>();
     go            = GameObject.Find("MainCharacter");
     MainCharacter = (Movescript)go.GetComponent(typeof(Movescript));
 }