Inheritance: MonoBehaviour
Example #1
0
 public override void AI()
 {
     try
     {
         if (this.bolt == null)
         {
             this.bolt = new LightningBolt(projectile.position, 0, 3f);
         }
         if (projectile.wet)
         {
             projectile.hostile  = true;
             projectile.friendly = false;
         }
         this.UpdateBolt();
         if (this.bolt.Ticks <= 0 && Main.rand.NextBool(1, 2))
         {
             this.bolt = new LightningBolt(projectile.position, projectile.position + Vector2.Normalize(projectile.velocity) * this.length, Main.rand.Next(3, 5), 4f);
         }
     }
     catch (Exception exception)
     {
         Main.NewText("Oh no, an error happened! Report this to Zerokk and send him the file Terraria/ModLoader/Logs/Logs.txt");
         ErrorLogger.Log(exception);
     }
 }
	//*************************************************************//	
	void Start () 
	{
		_normalLightingMat = ( Material ) Resources.Load ( "LightningMat" );
		_previewLightingMat = ( Material ) Resources.Load ( "LightningPreviewMat" );
		
		_myIComponent = gameObject.GetComponent < IComponent > ();
		
		_myIComponent.position[0] = Mathf.RoundToInt ( transform.root.position.x );
		_myIComponent.position[1] = Mathf.RoundToInt ( transform.root.position.z + 0.5f );	
		
		_lightinigEmmiterPrefab = ( GameObject ) Resources.Load ( "LightningEmitter" );
		_lightinigEmmiterInstant01 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant02 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant03 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant04 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant01.name = "lightinigEmmiterInstant01";
		_lightinigEmmiterInstant02.name = "lightinigEmmiterInstant02";
		_lightinigEmmiterInstant03.name = "lightinigEmmiterInstant03";
		_lightinigEmmiterInstant04.name = "lightinigEmmiterInstant04";
		_lightinigEmmiterInstant01.transform.parent = transform.root;
		_lightinigEmmiterInstant02.transform.parent = transform.root;
		_lightinigEmmiterInstant03.transform.parent = transform.root;
		_lightinigEmmiterInstant04.transform.parent = transform.root;
		_lightinigEmmiterBolt01 = _lightinigEmmiterInstant01.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt02 = _lightinigEmmiterInstant02.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt03 = _lightinigEmmiterInstant03.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt04 = _lightinigEmmiterInstant04.GetComponent < LightningBolt > ();
		_lightinigTargetInstant03 = new GameObject ( "target03" );
		_lightinigTargetInstant04 = new GameObject ( "target04" );
		_myHandleChoosenCharacter = handleBuild;
		_myMaterial = gameObject.renderer.material;
		
		_rememberedPositionOnMouseDown = new int[2];
	}
    public void UpdateBranch()
    {
        //go through our active bolts
        for (int i = boltsObj.Count - 1; i >= 0; i--)
        {
            //get the GameObject
            GameObject boltObj = boltsObj[i];

            //get the LightningBolt component
            LightningBolt boltComp = boltObj.GetComponent <LightningBolt>();

            //update/fade out the bolt
            boltComp.UpdateBolt();

            //if the bolt has faded
            if (boltComp.IsComplete)
            {
                //remove it from our list
                boltsObj.RemoveAt(i);

                //destroy it (would be better to pool but I'll let you figure out how to do that =P)
                Destroy(boltObj);
            }
        }
    }
    // Cache otjher gameObjects and set initial target.
    private void Start()
    {
        player = PlayerController.instance;

        lightningBolt = player.GetLightningBolt();
        SetTargetPos(player.transform.position);
    }
    public void Initilize(Vector2 start, Vector2 end, GameObject boltPrefab)
    {
        Start = start;
        End   = end;
        GameObject    mainBoltObj       = (GameObject)GameObject.Instantiate(boltPrefab);
        LightningBolt mainBoltComponent = mainBoltObj.GetComponent <LightningBolt> ();

        mainBoltComponent.Initilize(5);
        mainBoltComponent.ActivateBolt(start, end, Color.white, 1f);
        boltsObj.Add(mainBoltObj);
        int          numBranches  = Random.Range(3, 6);
        Vector2      diff         = end - start;
        List <float> branchPoints = new List <float> ();

        for (int i = 0; i < numBranches; i++)
        {
            branchPoints.Add(Random.value);
        }
        branchPoints.Sort();
        for (int i = 0; i < branchPoints.Count; i++)
        {
            Vector2       boltStart     = mainBoltComponent.GetPoint(branchPoints [i]);
            Quaternion    rot           = Quaternion.AngleAxis(30 * ((i & 1) == 0 ? 1 : -1), new Vector3(0, 0, 1));
            Vector2       adjust        = rot * (Random.Range(0.5f, 0.75f) * diff * (1 - branchPoints [i]));
            Vector2       boltEnd       = adjust + boltStart;
            GameObject    boltObj       = (GameObject)GameObject.Instantiate(boltPrefab);
            LightningBolt boltComponent = boltObj.GetComponent <LightningBolt> ();
            boltObj.transform.SetParent(this.transform);
            boltComponent.Initilize(5);
            Color color;
            color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1);
            boltComponent.ActivateBolt(boltStart, boltEnd, color, 1f);
            boltsObj.Add(boltObj);
        }
    }
Example #6
0
        public void GenerateLightningBoltStandard(LightningBolt bolt, Vector3 start, Vector3 end, int generation, int totalGenerations, float offsetAmount, LightningBoltParameters p)
        {
            if (generation < 1)
            {
                return;
            }

            LightningBoltSegmentGroup group = bolt.AddGroup();

            group.Segments.Add(new LightningBoltSegment {
                Start = start, End = end
            });

            // every generation, get the percentage we have gone down and square it, this makes lines thinner
            float widthMultiplier = (float)generation / (float)totalGenerations;

            widthMultiplier *= widthMultiplier;

            Vector3 randomVector;

            group.LineWidth          = p.TrunkWidth * widthMultiplier;
            group.Generation         = generation;
            group.Color              = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255.0f * widthMultiplier));
            group.EndWidthMultiplier = p.EndWidthMultiplier * p.ForkEndWidthMultiplier;
            if (offsetAmount <= 0.0f)
            {
                offsetAmount = (end - start).magnitude * p.ChaosFactor;
            }

            while (generation-- > 0)
            {
                int previousStartIndex = group.StartIndex;
                group.StartIndex = group.Segments.Count;
                for (int i = previousStartIndex; i < group.StartIndex; i++)
                {
                    start = group.Segments[i].Start;
                    end   = group.Segments[i].End;

                    // determine a new direction for the split
                    Vector3 midPoint = (start + end) * 0.5f;

                    // adjust the mid point to be the new location
                    RandomVector(bolt, ref start, ref end, offsetAmount, p.Random, out randomVector);
                    midPoint += randomVector;

                    // add two new segments
                    group.Segments.Add(new LightningBoltSegment {
                        Start = start, End = midPoint
                    });
                    group.Segments.Add(new LightningBoltSegment {
                        Start = midPoint, End = end
                    });

                    CreateFork(bolt, p, generation, totalGenerations, start, midPoint);
                }

                // halve the distance the lightning can deviate for each generation down
                offsetAmount *= 0.5f;
            }
        }
Example #7
0
 public GPChain(Vector2 position, GPlayer shoot, GEnemy target, List<GEnemy> list)
     : base(position, 14, Vector2.Zero, shoot)
 {
     tar = target;
     list.Add(tar);
     tag = list;
     bolt = new LightningBolt(pos, tar.pos);
 }
Example #8
0
        private int lightningBolt()
        {
            var multi    = getAttackMultiplier();
            var increase = getAttackModifier();
            var light    = new LightningBolt();

            Cooldowns[0] = light.Cooldown;
            return(light.Action(SpellPower, Crit, multi, increase));
        }
Example #9
0
 public void CreateFork(LightningBolt bolt, LightningBoltParameters p, int generation, int totalGenerations, Vector3 start, Vector3 midPoint)
 {
     if (ShouldCreateFork(p, generation, totalGenerations))
     {
         Vector3 branchVector = (midPoint - start) * p.ForkMultiplier();
         Vector3 splitEnd     = midPoint + branchVector;
         GenerateLightningBoltStandard(bolt, midPoint, splitEnd, generation, totalGenerations, 0.0f, p);
     }
 }
 /// <summary>
 /// Create multiple lightning bolts, attempting to batch them into as few draw calls as possible
 /// </summary>
 /// <param name="parameters">Lightning bolt creation parameters</param>
 public void CreateLightningBolts(ICollection <LightningBoltParameters> parameters)
 {
     if (parameters != null && parameters.Count != 0)
     {
         UpdateTexture();
         LightningBolt             bolt         = GetOrCreateLightningBolt();
         LightningBoltDependencies dependencies = CreateLightningBoltDependencies(parameters);
         bolt.SetupLightningBolt(dependencies);
     }
 }
Example #11
0
    public void SetTarget(Vector2 pos)
    {
        Targets.Add(pos);

        LightningBolt tmpLightningBolt = new LightningBolt(segmentLength, LightningBolts.Count, transform);

        tmpLightningBolt.Init(lightnings, lineRendererPrefab, lightRendererPrefab);
        LightningBolts.Add(tmpLightningBolt);
        LightningBolts[Targets.Count - 1].Activate();
    }
        public void GenerateLightningBolt(LightningBoltParameters p, LightningBolt bolt)
        {
            CurrentBolt = bolt;

            Vector3 start = p.ApplyVariance(p.Start, p.StartVariance);
            Vector3 end   = p.ApplyVariance(p.End, p.EndVariance);

            OnGenerateLightningBolt(start, end, p);

            CurrentBolt = null;
        }
 /// <summary>
 /// Create a lightning bolt
 /// </summary>
 /// <param name="p">Lightning bolt creation parameters</param>
 public virtual void CreateLightningBolt(LightningBoltParameters p)
 {
     if (p != null)
     {
         UpdateTexture();
         oneParameterArray[0] = p;
         LightningBolt             bolt         = GetOrCreateLightningBolt();
         LightningBoltDependencies dependencies = CreateLightningBoltDependencies(oneParameterArray);
         bolt.SetupLightningBolt(dependencies);
     }
 }
Example #14
0
        public void RandomVector(LightningBolt bolt, ref Vector3 start, ref Vector3 end, float offsetAmount, System.Random random, out Vector3 result)
        {
            if (bolt.CameraMode == CameraMode.Perspective)
            {
                Vector3 direction = (end - start).normalized;
                Vector3 side      = Vector3.Cross(start, end);
                if (side == Vector3.zero)
                {
                    // slow path, rarely hit unless cross product is zero
                    GetPerpendicularVector(ref direction, out side);
                }
                else
                {
                    side.Normalize();
                }

                // generate random distance and angle
                float distance = (((float)random.NextDouble() + 0.1f) * offsetAmount);

#if DEBUG
                float rotationAngle = ((float)random.NextDouble() * 360.0f);
                result = Quaternion.AngleAxis(rotationAngle, direction) * side * distance;
#else
                // optimized path for RELEASE mode, skips two normalize and two multiplies in Quaternion.AngleAxis
                float rotationAngle = ((float)random.NextDouble() * Mathf.PI);
                direction *= (float)System.Math.Sin(rotationAngle);
                Quaternion rotation;
                rotation.x = direction.x;
                rotation.y = direction.y;
                rotation.z = direction.z;
                rotation.w = (float)System.Math.Cos(rotationAngle);
                result     = rotation * side * distance;
#endif
            }
            else if (bolt.CameraMode == CameraMode.OrthographicXY)
            {
                // XY plane
                end.z = start.z;
                Vector3 directionNormalized = (end - start).normalized;
                Vector3 side     = new Vector3(-directionNormalized.y, directionNormalized.x, 0.0f);
                float   distance = ((float)random.NextDouble() * offsetAmount * 2.0f) - offsetAmount;
                result = side * distance;
            }
            else
            {
                // XZ plane
                end.y = start.y;
                Vector3 directionNormalized = (end - start).normalized;
                Vector3 side     = new Vector3(-directionNormalized.z, 0.0f, directionNormalized.x);
                float   distance = ((float)random.NextDouble() * offsetAmount * 2.0f) - offsetAmount;
                result = side * distance;
            }
        }
        internal void AddActiveBolt(LightningBolt bolt)
        {
#if DEBUG
            if (bolt == null || activeBolts.Contains(bolt))
            {
                UnityEngine.Debug.LogError("Attempted to add null or duplicate active lightning bolt");
                return;
            }
#endif

            // only called from the main thread
            activeBolts.Add(bolt);
        }
 private void UpdateActiveBolts()
 {
     for (int i = activeBolts.Count - 1; i >= 0; i--)
     {
         LightningBolt bolt = activeBolts[i];
         if (!bolt.Update())
         {
             // bolt is done, remove it and put back in cache
             activeBolts.RemoveAt(i);
             bolt.Cleanup();
             lightningBoltCache.Add(bolt);
         }
     }
 }
Example #17
0
 public void UpdateBranch()
 {
     for (int i = boltsObj.Count - 1; i >= 0; i--)
     {
         GameObject    boltObj  = boltsObj [i];
         LightningBolt boltComp = boltObj.GetComponent <LightningBolt> ();
         boltComp.UpdateBolt();
         if (boltComp.IsComplete)
         {
             boltsObj.RemoveAt(i);
             Destroy(boltObj);
         }
     }
 }
        private LightningBolt GetOrCreateLightningBolt()
        {
            if (lightningBoltCache.Count == 0)
            {
#if ENABLE_PROFILING
                Debug.Log("Lightning cache miss");
#endif

                return(new LightningBolt());
            }
            LightningBolt b = lightningBoltCache[lightningBoltCache.Count - 1];
            lightningBoltCache.RemoveAt(lightningBoltCache.Count - 1);

            return(b);
        }
Example #19
0
    void Awake()
    {
        LightningBolts = new List <LightningBolt>();
        Targets        = new List <Vector2>();

        LightningBolt tmpLightningBolt;

        for (int i = 0; i < chainLength; i++)
        {
            tmpLightningBolt = new LightningBolt(segmentLength, i);
            tmpLightningBolt.Init(lightnings, lineRendererPrefab, lightRendererPrefab, gameObject);
            LightningBolts.Add(tmpLightningBolt);
        }
        //  BuildChain();
    }
Example #20
0
    private static void CreatePooledBolt(Vector2 source, Vector2 dest, Color color, float thickness, float layer)
    {
        if (inactiveBoltsObj.Count > 0)
        {
            GameObject boltObj = inactiveBoltsObj[inactiveBoltsObj.Count - 1];

            boltObj.SetActive(true);

            activeBoltsObj.Add(boltObj);
            inactiveBoltsObj.RemoveAt(inactiveBoltsObj.Count - 1);

            LightningBolt boltComponent = boltObj.GetComponent <LightningBolt> ();

            boltComponent.ActivateBolt(source, dest, color, thickness, layer);
        }
    }
Example #21
0
 public void CreatePooledBolt(Vector2 source, Vector2 dest, float thickness)
 {
     //for (int i = 0; i < BoltCount; i++) {
     if (inactiveBoltsObj.Count > 0)
     {
         GameObject boltObj = inactiveBoltsObj [inactiveBoltsObj.Count - 1];
         boltObj.SetActive(true);
         activeBoltsObj.Add(boltObj);
         inactiveBoltsObj.RemoveAt(inactiveBoltsObj.Count - 1);
         LightningBolt boltComponent = boltObj.GetComponent <LightningBolt> ();
         Color         color;
         color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0.4f, 0.6f));
         boltComponent.Tint = color;
         boltComponent.ActivateBolt(source, dest, color, thickness);
     }
     //}
 }
        /// <summary>
        /// Create multiple lightning bolts, attempting to batch them into as few draw calls as possible
        /// </summary>
        /// <param name="parameters">Lightning bolt creation parameters</param>
        public void CreateLightningBolts(ICollection <LightningBoltParameters> parameters)
        {
#if UNITY_EDITOR
            if (Camera == null)
            {
                UnityEngine.Debug.LogError("Camera not assigned to lightning script. Either set the camera or tag your camera as main camera.");
            }
#endif

            if (parameters != null && parameters.Count != 0 && Camera != null)
            {
                UpdateTexture();
                LightningBolt             bolt         = GetOrCreateLightningBolt();
                LightningBoltDependencies dependencies = CreateLightningBoltDependencies(parameters);
                bolt.SetupLightningBolt(dependencies);
            }
        }
    // Cache components and create objects.
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        rigidbody     = GetComponent <Rigidbody2D>();
        anim          = GetComponent <Animator>();
        lightningBolt = Instantiate(lightningBoltPrefab);

        health = maxHealth;
    }
        /// <summary>
        /// Create a lightning bolt
        /// </summary>
        /// <param name="p">Lightning bolt creation parameters</param>
        public virtual void CreateLightningBolt(LightningBoltParameters p)
        {
#if UNITY_EDITOR
            if (Camera == null)
            {
                UnityEngine.Debug.LogError("Camera not assigned to lightning script. Either set the camera or tag your camera as main camera.");
            }
#endif

            if (p != null && Camera != null)
            {
                UpdateTexture();
                oneParameterArray[0] = p;
                LightningBolt             bolt         = GetOrCreateLightningBolt();
                LightningBoltDependencies dependencies = CreateLightningBoltDependencies(oneParameterArray);
                bolt.SetupLightningBolt(dependencies);
            }
        }
    private void LightningStrike(int tag, Vector3 position, Quaternion rotation, int frequency)
    {
        if (!poolDictionary.ContainsKey(tag))
        {
            Debug.LogWarning(tag + "doesn't exist.");
            return;
        }
        GameObject poolie = poolDictionary[tag].Dequeue();

        //frequency needs to be a value between 0 and 1.

        poolie.transform.position = position;
        poolie.transform.rotation = rotation;

        //gradient schenanigans
        _gradient = new Gradient();

        _colorKey          = new GradientColorKey[2];
        _colorKey[0].color = _colourStorage[frequency];
        _colorKey[0].time  = 0.0f;
        _colorKey[1].color = _colourStorage[frequency];
        _colorKey[1].time  = 1.0f;

        _alphaKey          = new GradientAlphaKey[2];
        _alphaKey[0].alpha = 1.0f;
        _alphaKey[0].time  = 0.0f;
        _alphaKey[1].alpha = 0.0f;
        _alphaKey[1].time  = 1.0f;

        _gradient.SetKeys(_colorKey, _alphaKey);

        poolie.GetComponent <TrailRenderer>().colorGradient = _gradient;
        poolie.GetComponent <TrailRenderer>().Clear();
        poolie.SetActive(true);

        LightningBolt bolt = poolie.GetComponent <LightningBolt>();

        bolt.maxPointDistance = Random.Range(15, 40);
        bolt.startHeight      = position.y;
        bolt.endHeight        = position.y - lightningLength;
        bolt.GeneratePoints();

        poolDictionary[tag].Enqueue(poolie);
    }
Example #26
0
        public void Setup()
        {
            GlobalReference.GlobalValues = new GlobalValues();

            defaultValues = new Mock <IDefaultValues>();
            dice          = new Mock <IDice>();
            tagWrapper    = new Mock <ITagWrapper>();
            translator    = new Mock <ITranslator>();

            defaultValues.Setup(e => e.DiceForSpellLevel(30)).Returns(dice.Object);
            tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x));
            translator.Setup(e => e.Translate(Translator.Languages.AncientMagic, It.IsAny <string>())).Returns((Translator.Languages x, string y) => (y));

            GlobalReference.GlobalValues.DefaultValues = defaultValues.Object;
            GlobalReference.GlobalValues.TagWrapper    = tagWrapper.Object;
            GlobalReference.GlobalValues.Translator    = translator.Object;

            lightningBolt = new LightningBolt();
        }
Example #27
0
    void CreateBolt()
    {
        // random cloud at first
        GameObject cloud = WeatherController.Instance.cloudList[Random.Range(0, WeatherController.Instance.cloudList.Count - 1)];

        GameObject boltObj = Instantiate(lightningPrefab);

        boltObj.transform.SetParent(WeatherController.Instance.cloudParent.transform);
        LightningBolt bolt     = boltObj.GetComponent <LightningBolt>();
        Vector3       startPos = new Vector3(cloud.transform.localPosition.x + WeatherController.Instance.lightningXOffset, cloud.transform.localPosition.y - WeatherController.Instance.lightningYOffset, 1);
        Vector3       endPos   = new Vector3(cloud.transform.localPosition.x + WeatherController.Instance.lightningXOffset, 0, 1);

        bolt.StartPosition = startPos;
        bolt.EndPosition   = endPos;

        //  bolt.Trigger(startPos, endPos);
        //  bolt.Trigger( );
        Destroy(boltObj, WeatherController.Instance.lightningDuration);
    }
Example #28
0
    void CreatePooledBolt(Vector2 source, Vector2 dest, Color color, float thickness)
    {
        //if there is an inactive bolt to pull from the pool
        if (inactiveBoltsObj.Count > 0)
        {
            //pull the GameObject
            GameObject boltObj = inactiveBoltsObj[inactiveBoltsObj.Count - 1];

            //move it to the active list
            boltObj.SetActive(true);
            activeBoltsObj.Add(boltObj);
            inactiveBoltsObj.RemoveAt(inactiveBoltsObj.Count - 1);

            //activate the bolt using the given position data
            LightningBolt lb = boltObj.GetComponent <LightningBolt>();
            lb.ActivateBolt(source, dest, color, thickness);
            lb.Draw();
        }
    }
Example #29
0
        public Rotation(ShamanTalents talents, SpellBox spellBox, IRotationOptions rotOpt)
            : this()
        {
            Talents = talents;
            LB      = spellBox.LB;
            CL      = spellBox.CL;
            LvB     = spellBox.LvB;
            LvBFS   = spellBox.LvBFS;
            FS      = spellBox.FS;
            ES      = spellBox.ES;
            FrS     = spellBox.FrS;
            FN      = spellBox.FN;
            ST      = spellBox.ST;
            MT      = spellBox.MT;
            FE      = spellBox.FE;

            useDpsFireTotem = rotOpt.UseDpsFireTotem;

            CalculateRotation(rotOpt.UseFireNova, rotOpt.UseChainLightning, rotOpt.UseDpsFireTotem, rotOpt.UseFireEle);
        }
Example #30
0
    private void Awake()
    {
        bolts          = new List <GameObject>();
        lightningBolts = new List <LightningBolt>();
        radiusSprite.transform.localScale = new Vector3(1 * SpellRadius, 1 * SpellRadius, 1);

        for (int i = 0; i < numBolts; i++)
        {
            //instantiate all of the bolts and add them to a list
            GameObject bolt = Instantiate(boltPrefab);
            bolt.transform.parent = transform;
            bolts.Add(bolt);

            //get access to the lightning bolt components for later use
            LightningBolt lightningBolt = bolt.GetComponent <LightningBolt>();
            lightningBolts.Add(lightningBolt);
        }

        InvokeRepeating("Hit", 0f, hitRate);
    }
Example #31
0
 public void Start()
 {
     gm         = FindObjectOfType <GameManager>();
     fire       = AllSpells[0].GetComponent <Fireball>();
     frost      = AllSpells[1].GetComponent <FrostBolt>();
     lightning  = AllSpells[2].GetComponent <LightningBolt>();
     meteor     = AllSpells[5].GetComponent <Meteor>();
     cone       = AllSpells[3].GetComponent <Cone>();
     ghostcast  = AllSpells[4].GetComponent <GhostCast>();
     doublecast = AllSpells[6].GetComponent <DoubleCast>();
     splitcast  = AllSpells[7].GetComponent <SplitCast>();
     companion  = AllSpells[8].GetComponent <Companion>();
     boost      = AllSpells[9].GetComponent <Boost>();
     hasten     = AllSpells[10].GetComponent <Hasten>();
     empower    = AllSpells[11].GetComponent <Empower>();
     blackhole  = AllSpells[12].GetComponent <BlackHole>();
     push       = AllSpells[13].GetComponent <Push>();
     pool       = AllSpells[14].GetComponent <Pool>();
     chaosorb   = AllSpells[15].GetComponent <ChaosOrb>();
     channling  = AllSpells[16].GetComponent <Channeling>();
     blessedaim = AllSpells[17].GetComponent <BlessedAim>();
 }
 void Start()
 {
     lightingBoltScript = GetComponent<LightningBolt>();                                                 // get reference to lightingBolt script;
 }
Example #33
0
 internal void SetBolt(Vector2 target)
 {
     bolt = new LightningBolt(pos, target);
 }
Example #34
0
 public void Destroy(LightningBolt c)
 {
     scriptLight = c;
 }
 // Use this for initialization
 void Start()
 {
     bolt = lightningBolt.GetComponent<LightningBolt> ();
     visible = false;
 }
Example #36
0
 protected virtual void OnGenerateLightningBolt(LightningBolt bolt, Vector3 start, Vector3 end, LightningBoltParameters p)
 {
     GenerateLightningBoltStandard(bolt, start, end, p.Generations, p.Generations, 0.0f, p);
 }
Example #37
0
    protected void UpdateLightning()
    {
        if ( Manager == null )
            return;
        if ( Orch == null )
            return;

        Nuaj.ModuleCloudVolume.CloudLayer	Cloud = m_Manager.ModuleCloudVolume.CloudLayersCount > 0 ? m_Manager.ModuleCloudVolume.CloudLayers[0] as Nuaj.ModuleCloudVolume.CloudLayer : null;
        if ( Cloud == null )
            return;

        if ( m_LightningBolts == null )
        {
            UnityEngine.Object[]	Bolts = FindObjectsOfType( typeof(NuajLightningBolt) );
            if ( Bolts == null || Bolts.Length == 0 )
                return;

            m_LightningBolts = new LightningBolt[Bolts.Length];
            for ( int BoltIndex=0; BoltIndex < Bolts.Length; BoltIndex++ )
                m_LightningBolts[BoltIndex] = new LightningBolt( Bolts[BoltIndex] as NuajLightningBolt );
        }

        // Check if we're in stormy conditions
        bool	bEnableLightning = m_Orch.WeatherTypeSource == NuajOrchestrator.WEATHER_PRESETS.STORM || m_Orch.WeatherTypeTarget == NuajOrchestrator.WEATHER_PRESETS.STORM;
        float	LightningImportance = m_Orch.WeatherTypeSource == NuajOrchestrator.WEATHER_PRESETS.STORM ? 1.0f - m_Orch.WeatherBalance : m_Orch.WeatherBalance;

        foreach ( LightningBolt Bolt in m_LightningBolts )
            Bolt.Update( this, DEMO_SPEED * Nuaj.NuajTime.DeltaTime, bEnableLightning, LightningImportance, Cloud.Altitude, Cloud.Thickness );
    }
Example #38
0
 // Use this for initialization
 void Start()
 {
     lightningBolt = transform.GetChild(0).GetComponent<LightningBolt>();
 }
Example #39
0
    //-----------------------------------------------------------------
    // Metodos
    //-----------------------------------------------------------------
    void Awake()
    {
        this.enabled = true;   // due to this, Update() is not called on the owner client.

        if (!photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            this.enabled = false;
        }
        scriptLight = null;
    }