Ejemplo n.º 1
0
        void Awake()
        {
            thisObj = gameObject;
            thisT   = transform;

            thisObj.layer = LayerManager.LayerShootObject();

            if (autoSearchLineRenderer)
            {
                LineRenderer[] lines = thisObj.GetComponentsInChildren <LineRenderer>(true);
                for (int i = 0; i < lines.Length; i++)
                {
                    lineList.Add(lines[i]);
                }
            }

            TrailRenderer[] trails = thisObj.GetComponentsInChildren <TrailRenderer>(true);
            for (int i = 0; i < trails.Length; i++)
            {
                trailList.Add(trails[i]);
            }

            if (shootEffect != null)
            {
                ObjectPoolManager.New(shootEffect, 3);
            }
            if (hitEffect != null)
            {
                ObjectPoolManager.New(hitEffect, 3);
            }
        }
Ejemplo n.º 2
0
        // Use this for initialization
        void Start()
        {
            UnitTower[] towers = FindObjectsOfType(typeof(UnitTower)) as UnitTower[];
            for (int i = 0; i < towers.Length; i++)
            {
                BuildManager.PreBuildTower(towers[i]);
            }

            //ignore collision between shootObject so they dont hit each other
            int soLayer = LayerManager.LayerShootObject();

            Physics.IgnoreLayerCollision(soLayer, soLayer, true);

            if (capLife)
            {
                playerLife = GetPlayerLifeCap();
            }
            if (onLifeE != null)
            {
                onLifeE(0);
            }

            if (enableLifeGen)
            {
                StartCoroutine(LifeRegenRoutine());
            }
        }
Ejemplo n.º 3
0
        void Awake()
        {
            thisObj = gameObject;
            thisT   = transform;

            thisObj.layer = LayerManager.LayerShootObject();

            if (autoSearchLineRenderer)
            {
                LineRenderer[] lines = thisObj.GetComponentsInChildren <LineRenderer>(true);
                for (int i = 0; i < lines.Length; i++)
                {
                    lineList.Add(lines[i]);
                }
            }

            TrailRenderer[] trails = thisObj.GetComponentsInChildren <TrailRenderer>(true);
            for (int i = 0; i < trails.Length; i++)
            {
                trailList.Add(trails[i]);
            }

            if (type == _ShootObjectType.FPSProjectile)
            {
                SphereCollider sphereCol = GetComponent <SphereCollider>();
                if (sphereCol == null)
                {
                    sphereCol        = thisObj.AddComponent <SphereCollider>();
                    sphereCol.radius = 0.15f;
                }
                hitRadius = sphereCol.radius;
            }

            if (shootEffect != null)
            {
                ObjectPoolManager.New(shootEffect);
            }
            if (hitEffect != null)
            {
                ObjectPoolManager.New(hitEffect);
            }
        }