コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     GunShot = this.GetComponent <AudioSource>();
     sg      = this.GetComponent <ShootGun>();
     gr      = this.GetComponentInParent <GunRecoiler>();
     //guic = this.GetComponent<GunnerUIController>();
     timeSinceShot = 0.0f;
     ammoCount     = magazineSize;
     timeReloading = 0.0f;
     reloading     = false;
     rm            = this.GetComponentInParent <ReloadManager>();
 }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        specs = GetComponent <PlayerSpecs>();

        // Get Enemy GameObject
        foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player"))
        {
            if (player.name != name)
            {
                enemyShootGun = player.GetComponent <ShootGun>();
                break;
            }
        }

        StartCoroutine(Perk());
    }
コード例 #3
0
    void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
    {
        isFading = false;
        Camera.main.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>().profile.chromaticAberration.enabled = false;

        if (SceneManager.GetActiveScene().name.Contains("Play"))
        {
            player = GameObject.FindGameObjectWithTag("Player").transform;


            PlayerController pc  = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
            ShootGun         gun = pc.transform.GetChild(0).GetComponent <ShootGun>();

            gun.clipSize += extendedMag;
        }
        else if (SceneManager.GetActiveScene().name.Contains("SelectPower"))
        {
            AddCannisters(Random.Range(1, 4));
        }
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: tuturox91/BookApp
        static void Main(string[] args)
        {
            Car myCar = new Car();      //Конструктор по умолчанию

            myCar.Name  = "Mitsubishi"; //меняем публичные переменные
            myCar.Speed = 10;
            for (int i = 0; i <= 10; i++)
            {
                myCar.SpeedUp(5);
                myCar.PrintState();
            }

            Car SecondCar = new Car(); //Измененный стандартный конструктор

            SecondCar.PrintState();

            //Свой конструктор класса
            Car ThirdCar = new Car("Mazda", 30);

            ThirdCar.PrintState();
            ThirdCar.SpeedUp(5);
            ThirdCar.PrintState();

            Motoscycles FirstMoto = new Motoscycles("Harley");

            FirstMoto.PrintState();

            Motoscycles SecondMoto = new Motoscycles(7);

            SecondMoto.PrintState();

            Motoscycles ThirdMoto = new Motoscycles(30, "Honda");

            ThirdMoto.PrintState();

            Motoscycles.StaticPhunk();

            //ст 193
            SavingAccount FirstAcc = new SavingAccount(50);

            FirstAcc.PrintState();

            SavingAccount SecondAcc = new SavingAccount(100);

            SavingAccount.SetInterestRate(0.03);
            SecondAcc.PrintState();

            SavingAccount ThirdAcc = new SavingAccount(1000.33);

            ThirdAcc.PrintState();
            //

            StaticClass.PrintTime();
            StaticClass.PritDate();

            int[] kek = { 3, 2, 1, 4, 5, 6 };


            Array.Sort(kek);

            RocketLowncher Bazooka = new RocketLowncher();

            Bazooka.Shoot();
            ShootGun Rm = new ShootGun();

            Rm.Shoot();
            Gun Pistol = new Gun();

            Pistol.ammo = 30;
            Console.WriteLine("Ammo in pistol: {0}", Pistol.ammo);
            Pistol.Shoot();
            Pistol.ammo--;
            Console.WriteLine("Ammo in pistol: {0}", Pistol.ammo);

            Console.ReadLine();
        }