Exemplo n.º 1
0
        void Awake()
        {
            speed_cached            = speed;
            bouncing_max_targets_bk = bouncing_max_targets;
            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);
            }
        }
Exemplo 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);

            //playerLife=playerLifeCap;
            if (capLife)
            {
                playerLife = Mathf.Min(playerLife, GetPlayerLifeCap());
            }

            if (enableLifeGen)
            {
                StartCoroutine(LifeRegenRoutine());
            }
        }