Ejemplo n.º 1
0
        void AddSubtrail(Vector3 position)
        {
            TentacleInstance tr = new TentacleInstance();

            tr.Trail             = (TrailRenderer)GameObject.Instantiate(Trail, position, Quaternion.identity);
            tr.Trail.endWidth   *= 0.5f;
            tr.Trail.startWidth *= 0.5f;

            tr.Trail.transform.parent  = this.transform;
            tr.Trail.transform.forward = Vector3.up;
            tr.TimeTmp  = Time.time;
            tr.Duration = Random.Range(0, SubDuration);
            subTrails.Add(tr);
        }
Ejemplo n.º 2
0
        void Start()
        {
            subTrails = new List <TentacleInstance> ();
            timeTmp   = Time.time;

            trails = new TentacleInstance[Number];
            for (int i = 0; i < trails.Length; i++)
            {
                Vector3 spread = new Vector3(Random.Range(-SpreadSpawn.x, SpreadSpawn.x), Random.Range(-SpreadSpawn.y, SpreadSpawn.y), Random.Range(-SpreadSpawn.z, SpreadSpawn.z)) * 0.01f;

                trails [i]       = new TentacleInstance();
                trails [i].Trail = (TrailRenderer)GameObject.Instantiate(Trail, this.transform.position + spread, Quaternion.identity);
                trails [i].Trail.transform.forward = Vector3.up;
                trails [i].TimeTmp                = Time.time;
                trails [i].TimeSubTmp             = Time.time;
                trails [i].SubNumber              = SubNumber;
                trails [i].SpawnRate              = SubRate;
                trails [i].Trail.transform.parent = this.transform;
            }
        }