Example #1
0
 void Start()
 {
     Debug.Log("called here");
     charController = GetComponent <CharacterController>();
     gunMovement    = GetComponentInChildren <GunMovement>();
     gunMovement.gameObject.SetActive(false);
 }
    // Use this for initialization
    public void Start()
    {
        playerController = GameObject.FindObjectOfType<PlayerController>();
        gunController = this.GetComponentInParent<GunMovement> ();

        if (this.gameObject.tag == "Weapon") {
            canPickup = false;
            Muzzle = GameObject.Find (this.gameObject.name + "Muzzle");
            bulletSpawn = GameObject.Find (this.gameObject.name + "BulletSpawn").transform;
            magazineSpawn = GameObject.Find (this.gameObject.name + "MagazineSpawn").transform;
            PrimaryGunSlot = GameObject.Find ("GunHolder");
            SecondaryGunSlot = GameObject.Find ("SecondGun");
            OutOfAmmo = false;
            ADS = false;
            isReloading = false;
            OutOfAmmo = false;
            MagazineDropped = false;
            isShotgun = false;
            isSniper = false;
            isAutomatic = false;
            CurrentRate = 0f;
            CurrentReloadRate = 0f;
            InitializeGuns (this.gameObject.name);
            crossHairs = GameObject.Find ("CH").GetComponent<Crosshairs> ();
        } else if (this.gameObject.tag == "Pickup") {
            pickUpText = GameObject.Find ("PickupText").GetComponent<Text>();
        }
    }