Example #1
0
    // Use this for initialization
    IEnumerator Start()
    {
        spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
        updateUI     = GameObject.Find("PlayerUI").GetComponent <UpdateUIRefrence>().updateUI;
        yield return(new WaitForSeconds(0.3f));

        checkDistances();
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     isServer     = parent.GetComponent <AISetup>().isServer;
     spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
     // This would cast rays only against colliders in layer 8.
     // But instead we want to collide against everything except layer 8. The ~ operator does this, it inverts a bitmask.
     layerMask = ~layerMask;
     frames    = Random.Range(0, 12);
     StartCoroutine(Wait());
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     muzzleMaterial = muzzleFlash.GetComponent <Renderer>().material;
     muzzleMaterial.SetFloat("Vector1_B173D9FB", 0);
     localiseTransform = GameObject.Find("Items").GetComponent <LocaliseTransform>();
     spawnWeapons      = GameObject.Find("Items").GetComponent <SpawnWeapons>();
     //AimSync = transform.Find("AimSync").gameObject;
     hinge       = weapon.GetComponent <HingeJoint>();
     hingeSpring = hinge.spring;
 }
Example #4
0
    // Use this for initialization
    IEnumerator Start()
    {
        bulletPositioner = GameObject.Find("Bullet Positioner");

        aimShoot = GameObject.Find("Ragdoll").GetComponent <AimShoot>();

        shoot = GameObject.Find("Weapon").GetComponent <Shoot>();

        mass = transform.parent.parent.Find("Mass").gameObject;

        yield return(new WaitForEndOfFrame());

        refrenceKeeper = GameObject.Find("Local").GetComponent <RefrenceKeeper>();
        WeaponHand     = refrenceKeeper.WeaponParent;
        yield return(new WaitForSeconds(0.3f));

        spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
    }
Example #5
0
    IEnumerator Start()
    {
        yield return(new WaitForEndOfFrame());

        mouseFollow          = GameObject.Find("MouseFollower");
        Weapons              = GameObject.Find("Items").GetComponent <SpawnWeapons>().Weapons;
        serverRefrenceKeeper = GameObject.Find("Server Refrences").GetComponent <ServerRefrenceKeeper>();
        spawnWeapons         = GameObject.Find("Items").GetComponent <SpawnWeapons>();
        localiseTransform    = GameObject.Find("Items").GetComponent <LocaliseTransform>();
        switchWeapon         = GameObject.Find("Weapon").GetComponent <SwitchWeapon>();
        shoot            = GameObject.Find("Weapon").GetComponent <Shoot>(); //Get script
        Items            = GameObject.Find("Items").transform;
        bulletPositioner = GameObject.Find("Bullet Positioner").transform;   //Get the bullet positioner object

        //Wait because some of the next parts have not completed yet

        aimShoot       = GameObject.Find("Ragdoll").GetComponent <AimShoot>(); //Get script
        refrenceKeeper = GameObject.Find("Local").GetComponent <RefrenceKeeper>();
        refrenceKeeper.itemDistanceRefrences.Add(0);                           //Add a new space in the list for this item
        yield return(new WaitForEndOfFrame());

        updateUI = refrenceKeeper.updateUI;

        WeaponHand = refrenceKeeper.WeaponParent;

        Player = GameObject.Find("Ragdoll").transform;

        if (isClient)
        {
            transform.parent = Items;
            WeaponModel      = Instantiate(
                Weapons[WeaponIndex].WeaponItem.itemModel,
                transform.position,
                transform.rotation);
            WeaponModel.gameObject.layer = 11;
            for (int z = 0; z < WeaponModel.transform.childCount; z++)
            {
                WeaponModel.transform.GetChild(z).gameObject.layer = 11;
            }
            WeaponModel.transform.SetParent(transform);
            colliders = WeaponModel.transform.GetComponentsInChildren <MeshCollider>();

            /*foreach (MeshCollider collider in colliders)
             * {
             *  collider.convex = true;
             * }*/
            renderers = WeaponModel.transform.GetComponentsInChildren <Renderer>();
            foreach (Renderer renderer in renderers)
            {
                renderer.material = WeaponMat;
            }
            WeaponModel.transform.localPosition    = Weapons[WeaponIndex].WeaponItem.spawnPosition;
            WeaponModel.transform.localEulerAngles = Weapons[WeaponIndex].WeaponItem.spawnRotation;
            WeaponModel.transform.localScale       = Weapons[WeaponIndex].WeaponItem.spawnScale;
        }

        localiseTransform.setTransformItem(gameObject.transform.GetChild(0).gameObject, WeaponIndex);

        //Update global list of total items
        refrenceKeeper.itemCount++;

        NumberOfWeapons = serverRefrenceKeeper.numOfWeapons;

        individualCount = refrenceKeeper.itemCount; //Update private version of itemCount to add a private "id" so this script knows which part of the list is it's own entry;
        done            = true;
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     spawnWeapons      = GameObject.Find("Items").GetComponent <SpawnWeapons>();
     items             = GameObject.Find("Items");
     localiseTransform = GameObject.Find("Items").GetComponent <LocaliseTransform>();
 }
Example #7
0
    // Use this for initialization
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(0.3f));

        spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
    }
 void Start()
 {
     spawnWeapons = GameObject.Find("Items").GetComponent <SpawnWeapons>();
 }