void Start()
 {
     shooter = GetComponent <RaycastShoot>();
     if (shooter)
     {
         shooter.ShotFired += new RaycastShoot.ShotFiredEventHandler(ShotFired);
     }
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        hint = false;

        player      = GameObject.FindGameObjectWithTag("Player").GetComponent <FirstPersonController> ();    // as FirstPersonController;
        playerShoot = player.GetComponentInChildren <RaycastShoot> ();
        BeginTutorial0();
    }
Example #3
0
    public override void Initialize(GameObject obj)
    {
        rcShoot = obj.GetComponent <RaycastShoot>();
        rcShoot.Initialize();

        rcShoot.gunDamage          = gunDamage;
        rcShoot.weaponRange        = weaponRange;
        rcShoot.hitForce           = hitForce;
        rcShoot.laserLine.material = matsku;
    }
Example #4
0
    private void ChooseGun()
    {
        if (RaycastShoot.GetIfShot() && WeaponSwitching.GetSelectedWeapon() == 0)
        {
            //int score = EnemyController.GetScore();
            if (EnemyController.GotShot())
            {
                _currentScore += 5;
                IncreaseScore(_currentScore);
            }
        }

        if (RaycastShoot.GetIfShot() && WeaponSwitching.GetSelectedWeapon() == 1)
        {
            //int score = EnemyController.GetScore();
            if (EnemyController.GotShot())
            {
                _currentScore += 1;
                IncreaseScore(_currentScore);
            }
        }
    }
Example #5
0
    void WeaponEquipped(WeaponManager.ItemTypes weapon, int slot)
    {
        var cam = GameObject.Find("PlayerCamera");

        if (cam != null)
        {
            var existingWeapon = GameObject.Find("CurrentWeapon");
            if (existingWeapon != null)
            {
                Destroy(existingWeapon);
            }

            GameObject gun = null;
            switch (weapon)
            {
            case WeaponManager.ItemTypes.MachineGun:
            {
                gun = (GameObject)Instantiate(Resources.Load("MachineGun"), cam.transform, false);
                break;
            }

            case WeaponManager.ItemTypes.RailGun:
            {
                gun = (GameObject)Instantiate(Resources.Load("RailGun"), cam.transform, false);
                break;
            }
            }
            if (gun != null)
            {
                gun.name = "CurrentWeapon";
                gun.transform.localPosition    = new Vector3(0.2f, -0.171f, 0.212f);
                gun.transform.localEulerAngles = new Vector3(0, 91.0f, 0);
                weaponRaycast            = gun.GetComponent <RaycastShoot>();
                weaponRaycast.ShotFired += new RaycastShoot.ShotFiredEventHandler(ShotFired);
            }
            UpdateAmmo();
        }
    }