コード例 #1
0
    void Start()
    {
        bulletPools           = new List <ObjectPool>();
        impactPools           = new List <ObjectPool>();
        cloneSettings         = GetComponent <LineRenderer>();
        trailPool             = new ObjectPool(createTrail());
        cloneSettings.enabled = false;

        controller = GetComponent <GunController>();
        foreach (GunHandler g in controller.gunInventory)
        {
            GunObject gun = g.gun;
            g.gameObject.SetActive(true);
            g.Initialize();

            if (gun.shootType == GunObject.GunType.rigidbody && gun.rigidbodyBullet)
            {
                ObjectPool bulletPool = getFromPool(gun, gun.rigidbodyBullet, ref bulletPools);
                g.SetBulletPool(bulletPool.getPool);
            }

            if (gun.impactEffect == null)
            {
                continue;
            }
            ObjectPool impactPool = getFromPool(gun, gun.impactEffect, ref impactPools);
            g.SetImpactPool(impactPool.getPool);
        }

        if ((overlayAdjuster = GetComponentInParent <OverlayAdjuster>()) != null)
        {
            overlayAdjuster.GetScopes();
        }
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        rangeDif     = clearRange.GetDifference();
        blockMat     = GetComponent <Renderer>().material;
        blockedColor = blockMat.GetColor("_Color");
        //This transform is where we will be reading the distance from
        OverlayAdjuster overlay = null;

        if ((overlay = GetComponentInParent <OverlayAdjuster>()) != null)
        {
            distanceFrom = overlay.transform;
        }
    }
コード例 #3
0
    void Start()
    {
        bulletPools           = new List <ObjectPool>();
        impactPools           = new List <ObjectPool>();
        cloneSettings         = GetComponent <LineRenderer>();
        trailPool             = new ObjectPool(createTrail());
        cloneSettings.enabled = false;

        controller = GetComponent <GunController>();
        foreach (GunHandler g in controller.gunInventory)
        {
            InitializeGun(g);
        }

        if ((overlayAdjuster = GetComponentInParent <OverlayAdjuster>()) != null)
        {
            overlayAdjuster.GetScopes();
        }
    }