Example #1
0
 private void Start()
 {
     originPos    = Vector3.zero;
     audioSource  = GetComponent <AudioSource>();
     theCrosshair = FindObjectOfType <Crosshair>();
     thestatusHP  = FindObjectOfType <StatusHP>();
     monsterHp1   = FindObjectOfType <MonsterHp1>();
     thepig1      = FindObjectOfType <Pig1>();
 }
Example #2
0
    private void Start()
    {
        originPos    = Vector3.zero;
        audioSource  = GetComponent <AudioSource>();
        theCrosshair = FindObjectOfType <Crosshair>();
        thestatusHP  = FindObjectOfType <StatusHP>();
        monsterHp1   = FindObjectOfType <MonsterHp1>();
        thepig1      = FindObjectOfType <Pig1>();

        WeaponManager.currentWeapon     = currentGun.GetComponent <Transform>();
        WeaponManager.currentWeaponAnim = currentGun.anim;
    }
Example #3
0
        static void Main(string[] args)
        {
            Car myObj  = new Car();
            Car myObj1 = new Car();
            Car myObj2 = new Car();

            Console.WriteLine(myObj.color);
            Console.WriteLine(myObj1.color);
            Console.WriteLine(myObj2.color);
            Console.WriteLine(myObj.maxSpeed);

            Car Ford = new Car();

            Ford.model = "Mustang";
            Ford.col   = "red";
            Ford.year  = 1969;

            Car Opel = new Car();

            Opel.model = "Astra";
            Opel.col   = "white";
            Opel.year  = 2005;
            Console.WriteLine(Ford.model);
            Console.WriteLine(Opel.model);

            Car my_1 = new Car();

            my_1.fullThrottle();

            Console.WriteLine(Ford.model);

            Car Ford1 = new Car("Mustang");

            Console.WriteLine(Ford1.model);

            Car Ford2 = new Car("Mustang", "Red", 1969);

            Console.WriteLine(Ford2.color + " " + Ford2.year + " " + Ford2.model);

            //File

            string writeText = "Hello World!";            // Create a text string

            File.WriteAllText("filename.txt", writeText); // Create a file and write the content of writeText to it


            string readText = File.ReadAllText("filename.txt"); // Read the contents of the file

            Console.WriteLine(readText);                        // Output the content

            Animal myAnimal = new Animal();                     // Create a Animal object
            Animal myPig    = new Pig();                        // Create a Pig object
            Animal myDog    = new Dog();                        // Create a Dog object

            myAnimal.animalSound();
            myPig.animalSound();
            myDog.animalSound();


            Pig1 my_Pig = new Pig1(); // Create a Pig object

            my_Pig.animalSound1();    // Call the abstract method
            my_Pig.sleep();

            Pig2 my2Pig = new Pig2();  // Create a Pig object

            my2Pig.animalSound2();


            Level myVar = Level.Medium;

            Console.WriteLine(myVar);



            try
            {
                int[] myNumbers = { 1, 2, 3 };
                Console.WriteLine(myNumbers[10]);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            finally
            {
                Console.WriteLine("The 'try catch' is finished.");
            }
        }
Example #4
0
 private void Start()
 {
     thePig1 = GetComponent <Pig1>();
 }