Ejemplo n.º 1
0
    private void LegacyParticleSpeed(float fSpeed)
    {
        ParticleEmitter  pe = this.m_pe;
        ParticleAnimator pa = this.m_pa;
        ParticleRenderer pr = this.m_pr;

        if (pe == null || pr == null)
        {
            return;
        }
        Vector3         vector  = Vector3.get_one() * fSpeed;
        ParticleEmitter expr_3B = pe;

        expr_3B.set_minEnergy(expr_3B.get_minEnergy() / fSpeed);
        ParticleEmitter expr_49 = pe;

        expr_49.set_maxEnergy(expr_49.get_maxEnergy() / fSpeed);
        pe.set_worldVelocity(Vector3.Scale(pe.get_worldVelocity(), vector));
        pe.set_localVelocity(Vector3.Scale(pe.get_localVelocity(), vector));
        pe.set_rndVelocity(Vector3.Scale(pe.get_rndVelocity(), vector));
        ParticleEmitter expr_8D = pe;

        expr_8D.set_angularVelocity(expr_8D.get_angularVelocity() * fSpeed);
        ParticleEmitter expr_9B = pe;

        expr_9B.set_rndAngularVelocity(expr_9B.get_rndAngularVelocity() * fSpeed);
        ParticleEmitter expr_A9 = pe;

        expr_A9.set_emitterVelocityScale(expr_A9.get_emitterVelocityScale() * fSpeed);
        if (pa != null)
        {
            pa.set_rndForce(Vector3.Scale(pa.get_rndForce(), vector));
            pa.set_force(Vector3.Scale(pa.get_force(), vector));
        }
    }
Ejemplo n.º 2
0
        public void loadLayer()
        {
            particleRenderer = new ParticleRenderer();
            Rt = new RenderTarget2D(GameLoop.gameInstance.GraphicsDevice, GameSettings.Default.resolutionWidth, GameSettings.Default.resolutionHeight);

            foreach (LevelObject lo in loList)
            {
                lo.LoadContent();

                if (lo is ParticleObject)
                {
                    ParticleObject p = (ParticleObject)lo;
                    particleRenderer.addParticleObjects(p);
                }
            }

            particleRenderer.initializeParticles();

            //Effects.Add(e0);

            if (Effects == null)
            {
                Effects = new List <EffectObject>();
            }

            foreach (EffectObject eo in Effects)
            {
                //eo.Initialise();
                eo.LoadContent();
            }
        }
Ejemplo n.º 3
0
    void OnParticleCollision(GameObject other)
    {
        BaseWeapon incomingParticle = other.transform.parent.GetComponent <BaseWeapon>();

        SendMessage("TakeDamage", 1.0f - Mathf.Clamp01(incomingParticle.damage / Time.time), SendMessageOptions.DontRequireReceiver);

        ParticleRenderer curMat = incomingParticle.GetComponentInChildren <ParticleRenderer>();

        if (curMat.material == fireMat)
        {
            curDamageMat = fireMat;
        }
        else if (curMat.material == lightningMat)
        {
            curDamageMat = lightningMat;
        }
        else
        {
            // Wrong material
        }

        if (!isTakingExtraDamage)
        {
            isTakingExtraDamage = true;
        }
        else
        {
            isTakingExtraDamage = false;
        }
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Should be used only by ParticleRenderer!
 /// </summary>
 public void Init(int indx1, int indx2, ParticleRenderer particle, bool visible)
 {
     _particle    = particle;
     this.visible = visible;
     atomIndex1   = indx1;
     atomIndex2   = indx2;
 }
Ejemplo n.º 5
0
 // Apply event
 void IParserEventSubscriber.Apply(ConfigNode node)
 {
     MainEmitter             = (ParticleEmitter)body.AddComponent("MeshParticleEmitter");
     ParticleRender          = body.AddComponent <ParticleRenderer>();
     ParticleAnim            = body.AddComponent <ParticleAnimator>();
     ParticleRender.material = new Material(Shader.Find("Particles/Alpha Blended"));
 }
Ejemplo n.º 6
0
    public void TurnOffParticles()
    {
        completed = true;
        ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>();

        particles.enabled = false;
    }
Ejemplo n.º 7
0
    public void Awake()
    {
        gameObject.layer = Globals.LayerNumScenery;

        _particleEmitter  = (gameObject.AddComponent("EllipsoidParticleEmitter")) as ParticleEmitter;
        _particleRenderer = (gameObject.AddComponent("ParticleRenderer")) as ParticleRenderer;
        _particleAnimator = (gameObject.AddComponent("ParticleAnimator")) as ParticleAnimator;

        _particleEmitter.hideFlags  = HideFlags.HideAndDontSave;
        _particleRenderer.hideFlags = HideFlags.HideAndDontSave;
        _particleAnimator.hideFlags = HideFlags.HideAndDontSave;

        _particleAnimator.damping = _baseDamping;

        _particleEmitter.emit             = false;
        _particleRenderer.maxParticleSize = maxScreenSize;
        _particleRenderer.material        = material;
        _particleRenderer.material.color  = Color.white;        //workaround for this not being settable elsewhere
        _particleAnimator.sizeGrow        = sizeGrow;

        if (explodeOnAwake)
        {
            Explode();
        }
    }
Ejemplo n.º 8
0
        public void drawInEditor(SpriteBatch spriteBatch)
        {
            if (!isVisible)
            {
                return;
            }

            foreach (LevelObject lo in loList)
            {
                if (lo is DrawableLevelObject)
                {
                    DrawableLevelObject dlo = (DrawableLevelObject)lo;
                    if (dlo.isVisible)
                    {
                        dlo.drawInEditor(spriteBatch);
                    }
                }
            }

            if (particleRenderer == null)
            {
                particleRenderer = new ParticleRenderer(_graphicsM);
                particleRenderer.drawParticlesInEditor(_contentM);
            }
            particleRenderer.drawParticlesInEditor(_contentM);
        }
Ejemplo n.º 9
0
    void LegacyParticleSpeed(float fSpeed)
    {
        ParticleEmitter  pe = m_pe;
        ParticleAnimator pa = m_pa;
        ParticleRenderer pr = m_pr;

        if (pe == null || pr == null)
        {
            return;
        }

        Vector3 vecSpeed = Vector3.one * fSpeed;

        pe.minEnergy /= fSpeed;
        pe.maxEnergy /= fSpeed;

        pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, vecSpeed);
        pe.localVelocity         = Vector3.Scale(pe.localVelocity, vecSpeed);
        pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, vecSpeed);
        pe.angularVelocity      *= fSpeed;
        pe.rndAngularVelocity   *= fSpeed;
        pe.emitterVelocityScale *= fSpeed;

        if (pa != null)
        {
            pa.rndForce = Vector3.Scale(pa.rndForce, vecSpeed);
            pa.force    = Vector3.Scale(pa.force, vecSpeed);
//			pa.damping				*= fScale;
        }
//		pr.velocityScale			*= fSpeed;
    }
Ejemplo n.º 10
0
        public void Write(SceneWriter writer, object component)
        {
            ParticleRenderer pr = component as ParticleRenderer;

            if (pr == null)
            {
                throw new Exception(GetType() + " cannot export components of type " + component.GetType());
            }
            writer.WriteElement("enabled", pr.enabled);
            writer.WriteElement("sharedMaterials", pr.sharedMaterials);
            //writer.WriteElement("stretchParticles", pr.);
            writer.WriteElement("lengthScale", pr.lengthScale);
            writer.WriteElement("velocityScale", pr.velocityScale);
            //writer.WriteElement("cameraVelocityScale", pr.cameraVelocityScale);
            writer.WriteElement("maxParticleSize", pr.maxParticleSize);
            writer.WriteElement("uvAnimation", new Vector3(pr.uvAnimationXTile, pr.uvAnimationYTile, pr.uvAnimationCycles));

            Component c = pr.GetComponent("FFWD_EllipsoidParticleEmitterExport");

            if (c == null)
            {
                // Added for backwards compatibility
                c = pr.GetComponent("XNAEllipsoidParticleEmitter");
            }
            if (c != null)
            {
                writeValue <object>(writer, c, "stretchParticles");
            }
        }
        public void Init(Vessel v, int type)
        {
            attachedTo   = v;
            AsteriodType = type;

            if (AsteriodType == 1)             //Comet
            {
                try
                {
                    MainEmitter    = (ParticleEmitter)v.rootPart.gameObject.AddComponent("MeshParticleEmitter");
                    ParticleRender = v.rootPart.gameObject.AddComponent <ParticleRenderer>();
                    ParticleAnim   = v.rootPart.gameObject.AddComponent <ParticleAnimator>();

                    ParticleRender.material.mainTexture = Utils.LoadTexture("GameData/KittopiaSpace/Textures/Default/Glow.png");

                    MainEmitter.maxSize   = 20;
                    MainEmitter.minSize   = 10;
                    MainEmitter.maxEnergy = 5;
                    MainEmitter.minEnergy = 2.5f;

                    MainEmitter.useWorldSpace = false;

                    MainEmitter.rndVelocity = new Vector3(50, 50, 50);
                    MainEmitter.emit        = true;
                }
                catch {}
            }

            CanImpact = false;
        }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     if (lightning)
     {
         particleRenderer = lightning.GetComponent <ParticleRenderer>();
     }
 }
Ejemplo n.º 13
0
        private bool IsReferencedObject(ParticleRenderer component, KeyValuePair <int, TextureDetails> kvp)
        {
            bool isExist = true;

            if (component.material != null)
            {
                if (component.material.mainTexture != null &&
                    component.material.mainTexture.name.Contains(kvp.Value.objectName))
                {
                    return(!isExist);
                }

                for (int index = 0; index < _shaderTextures.Length; index++)
                {
                    string input = _shaderTextures[index];
                    if (component.material.GetTexture(input) != null &&
                        component.material.GetTexture(input).name.Contains(kvp.Value.objectName))
                    {
                        return(!isExist);
                    }
                }
            }

            return(isExist);
        }
Ejemplo n.º 14
0
    void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.tag == "Player" && !completed)
        {
            Debug.Log("Player entered");
            display   = true;
            completed = true;
            ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>();
            particles.enabled = false;

            /*Debug.Log("Quest completed! Investigated " + targetName);
             * completed = true;
             * Destroy(GetComponent<BoxCollider>());
             *
             * GameObject spawn = Instantiate(area, new Vector3(0.5f, 0.5f, -1), Quaternion.identity) as GameObject;
             * Area fromSpawn = spawn.GetComponent<Area>();
             * fromSpawn.guiTexture.texture = popupTexture;
             * fromSpawn.destroyAble = true;
             * fromSpawn.guiTexture.enabled = true;
             * fromSpawn.PopUpBackground.enabled = true;
             * fromSpawn.GetComponentInChildren<GUIText>().text = "Uppdrag avklarat " + targetName;
             *          Debug.Log ("X: "+fromSpawn.GetComponentInChildren<GUIText>().pixelOffset.x+"Y: "+fromSpawn.GetComponentInChildren<GUIText>().pixelOffset.y);
             */SaveCompleted();
        }
    }
Ejemplo n.º 15
0
        public bool ConnectToServer(string ip, int port)
        {
            var b = ServerHandler.Connect(ip, port);

            if (b)
            {
                ParticleRenderer = new ParticleRenderer();
                SkyboxRenderer   = new SkyboxRenderer();

                BlockPos playerPos = new BlockPos(0, 100, 0);//MathUtil.NextFloat(-100, 100));

                World = new WorldClientServer();

                Player = new EntityPlayerSp(World, playerPos.ToVec());

                World.AddEntity(Player);

                Player.SetItemStackInInventory(0, new ItemStack(ItemRegistry.GetItem(BlockRegistry.GetBlock <BlockCraftingTable>())));
                ResetMouse();

                MouseState state = Mouse.GetState();
                _mouseLast = new Point(state.X, state.Y);
            }

            return(b);
        }
Ejemplo n.º 16
0
            /// <summary>
            /// The main initialisation. Here we create the subcomponents.
            /// </summary>
            void Awake()
            {
                if (!GetComponent <ParticleEmitter>())
                {
                    emitter = gameObject.AddComponent <MeshParticleEmitter>();
                    emitter.useWorldSpace = false;
                    emitter.emit          = true;
                }
                else
                {
                    emitter = GetComponent <ParticleEmitter>();
                }

                if (!GetComponent <ParticleAnimator>())
                {
                    animator = gameObject.AddComponent <ParticleAnimator>();
                    animator.doesAnimateColor = true;
                }
                else
                {
                    animator = GetComponent <ParticleAnimator>();
                }

                if (!GetComponent <ParticleRenderer>())
                {
                    renderer          = gameObject.AddComponent <ParticleRenderer>();
                    renderer.material = new Material(Shader.Find("Particles/Alpha Blended"));
                }
                else
                {
                    renderer = GetComponent <ParticleRenderer>();
                }

                filter = !GetComponent <MeshFilter>() ? gameObject.AddComponent <MeshFilter>() : GetComponent <MeshFilter>();
            }
Ejemplo n.º 17
0
    private void LegacyParticleSpeed(float fSpeed)
    {
        ParticleEmitter  pe = this.m_pe;
        ParticleAnimator pa = this.m_pa;
        ParticleRenderer pr = this.m_pr;

        if (pe == null || pr == null)
        {
            return;
        }
        Vector3 b = Vector3.one * fSpeed;

        pe.minEnergy            /= fSpeed;
        pe.maxEnergy            /= fSpeed;
        pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, b);
        pe.localVelocity         = Vector3.Scale(pe.localVelocity, b);
        pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, b);
        pe.angularVelocity      *= fSpeed;
        pe.rndAngularVelocity   *= fSpeed;
        pe.emitterVelocityScale *= fSpeed;
        if (pa != null)
        {
            pa.rndForce = Vector3.Scale(pa.rndForce, b);
            pa.force    = Vector3.Scale(pa.force, b);
        }
    }
 ParticleRenderer partRend;// the new particle renderer
 void Start()
 {
     hero         = GameObject.Find("Hero");
     partEmit     = GetComponent <ParticleEmitter> ();
     partRend     = GetComponent <ParticleRenderer>();//importing the particle renderer
     HpText       = transform.FindChild("DoorHp").GetComponent <TextMesh>() as TextMesh;
     HpText.color = Color.green;
 }
Ejemplo n.º 19
0
 /**
  */
 public void CopyAttributesTo(ParticleRenderer renderer)
 {
     if (renderer == null)
     {
         throw new ArgumentNullException("renderer cannot be null!");
     }
     BeamRenderer_CopyAttributesTo(nativePtr, renderer.nativePtr);
 }
Ejemplo n.º 20
0
    private void LegacySetParticle()
    {
        ParticleEmitter  pe = this.m_pe;
        ParticleAnimator pa = this.m_pa;
        ParticleRenderer pr = this.m_pr;

        if (pe == null || pr == null)
        {
            return;
        }
        if (this.m_bLegacyRuntimeScale)
        {
            Vector3 b = Vector3.one * this.m_fStartSpeedRate;
            float   fStartSpeedRate = this.m_fStartSpeedRate;
            pe.minSize              *= this.m_fStartSizeRate;
            pe.maxSize              *= this.m_fStartSizeRate;
            pe.minEnergy            *= this.m_fStartLifeTimeRate;
            pe.maxEnergy            *= this.m_fStartLifeTimeRate;
            pe.minEmission          *= this.m_fStartEmissionRate;
            pe.maxEmission          *= this.m_fStartEmissionRate;
            pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, b);
            pe.localVelocity         = Vector3.Scale(pe.localVelocity, b);
            pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, b);
            pe.angularVelocity      *= fStartSpeedRate;
            pe.rndAngularVelocity   *= fStartSpeedRate;
            pe.emitterVelocityScale *= fStartSpeedRate;
            if (pa != null)
            {
                pa.rndForce = Vector3.Scale(pa.rndForce, b);
                pa.force    = Vector3.Scale(pa.force, b);
            }
            pr.lengthScale *= this.m_fRenderLengthRate;
        }
        else
        {
            Vector3 b2   = ((!this.m_bScaleWithTransform) ? Vector3.one : pe.transform.lossyScale) * this.m_fStartSpeedRate;
            float   num  = ((!this.m_bScaleWithTransform) ? 1f : NcTransformTool.GetTransformScaleMeanValue(pe.transform)) * this.m_fStartSpeedRate;
            float   num2 = ((!this.m_bScaleWithTransform) ? 1f : NcTransformTool.GetTransformScaleMeanValue(pe.transform)) * this.m_fStartSizeRate;
            pe.minSize              *= num2;
            pe.maxSize              *= num2;
            pe.minEnergy            *= this.m_fStartLifeTimeRate;
            pe.maxEnergy            *= this.m_fStartLifeTimeRate;
            pe.minEmission          *= this.m_fStartEmissionRate;
            pe.maxEmission          *= this.m_fStartEmissionRate;
            pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, b2);
            pe.localVelocity         = Vector3.Scale(pe.localVelocity, b2);
            pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, b2);
            pe.angularVelocity      *= num;
            pe.rndAngularVelocity   *= num;
            pe.emitterVelocityScale *= num;
            if (pa != null)
            {
                pa.rndForce = Vector3.Scale(pa.rndForce, b2);
                pa.force    = Vector3.Scale(pa.force, b2);
            }
            pr.lengthScale *= this.m_fRenderLengthRate;
        }
    }
Ejemplo n.º 21
0
        /// <summary>
        /// フレーム毎の描画処理を行います。
        /// </summary>
        protected override void OnRender(EventArgs e)
        {
            base.OnRender(e);

            if (ParticleRenderer != null)
            {
                ParticleRenderer.OnRenderFrame();
            }
        }
  void Start()
  {
      oneOverZigs = 1f / (float)zigs;
      GetComponent <ParticleEmitter>().emit = false;

      GetComponent <ParticleEmitter>().Emit(zigs);
      particles = GetComponent <ParticleEmitter>().particles;
      rend      = GetComponent <ParticleRenderer>();
  }
Ejemplo n.º 23
0
 void Awake()
 {
     oneOverZigs = 1f / (float)zigs;
     GetComponent <ParticleEmitter>().emit = false;
     particleRenderer = GetComponent <ParticleRenderer>();
     GetComponent <ParticleEmitter>().Emit(zigs);
     particles = GetComponent <ParticleEmitter>().particles;
     particleRenderer.enabled = false;
 }
Ejemplo n.º 24
0
        public Particle(ParticleController controller, ParticleRenderer renderer)
        {
            Controller = controller;
            Renderer   = renderer;

            Angle = Lens.util.math.Rnd.AnglePI();
            Rnd   = Lens.util.math.Rnd.Int(1024);
            T     = Lens.util.math.Rnd.Float(1f);
        }
Ejemplo n.º 25
0
 	private void analyzeComponent( Component component, StringBuilder dump, string indent )
 	{
 		// early out if component is missing
 		if( component == null )
 			return;
  
 		List<Material> materials = new List<Material>();
 		switch( component.GetType().ToString() )
 		{
 		case "UnityEngine.MeshRenderer":
 			{
 				MeshRenderer mr = component as MeshRenderer;
 				foreach( Material mat in mr.sharedMaterials )
 					materials.Add( mat );
 			}
 			break;
 		case "UnityEngine.ParticleRenderer":
 			{
 				ParticleRenderer pr = component as ParticleRenderer;
 				foreach( Material mat in pr.sharedMaterials )
 					materials.Add( mat );
 			}
 			break;
 		default:
 			break;
 		}
  
 		bool materialMissing = false;
 		foreach( Material mat in materials )
 		{
 			if( mat == null )
 			{
 				materialMissing = true;
 				dump.Append( indent + "> MISSING\n" );
 			}
 			else
 			{
 				ListItem item;
 				mSelectionMaterials.TryGetValue( mat, out item );
 				if( item == null )
 				{
 					item = new ListItem();
 					mSelectionMaterials.Add( mat, item );
 				}
 				item.GameObjects.Add( component.gameObject );
  
 				string matName = mat.shader != null ?
 				mat.name + " <" + mat.shader.name + ">" :
 				mat.name + " <MISSING>";
 				dump.Append( indent + "> " + matName + "\n" );
 			}
 		}
  
 		if( materialMissing )
 			Debug.LogWarning( "Material(s) missing in game object '" + component.gameObject + "'!" );
 	}
Ejemplo n.º 26
0
 void Start()
 {
     completed = false;
     if (description == "Avklarad!")
     {
         completed = true;
         ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>();
         particles.enabled = false;
     }
 }
    void Start()
    {
        ParticleRenderer partRend = GetComponent <ParticleRenderer>();

        if (partRend != null)
        {
            partRend.sortingLayerName = sortingLayerName;
            partRend.sortingOrder     = sortingLayerInt;
        }
    }
Ejemplo n.º 28
0
 private static int _CreateParticleRenderer(IntPtr L)
 {
     if (LuaDLL.lua_gettop(L) == 0)
     {
         ParticleRenderer obj = new ParticleRenderer();
         LuaScriptMgr.Push(L, obj);
         return(1);
     }
     LuaDLL.luaL_error(L, "invalid arguments to method: ParticleRenderer.New");
     return(0);
 }
Ejemplo n.º 29
0
        public AnimatedParticle(ParticleController controller, ParticleRenderer renderer, string animation, string tag = null) : base(controller, renderer)
        {
            Animation = Animations.Create(animation);

            if (tag != null)
            {
                Animation.Tag = tag;
            }

            Animation.OnEnd += () => { Done = true; };
        }
    // Use this for initialization
    void Start()
    {
        StartCoroutine("flareLightoff");

        flarelight      = GetComponent <Light>();
        flaresound      = GetComponent <AudioSource>();
        smokepParSystem = GetComponent <ParticleRenderer>();


        Destroy(gameObject, flareTimer + 1f);
    }
Ejemplo n.º 31
0
            // Apply event
            void IParserEventSubscriber.Apply(ConfigNode node)
            {
                MainEmitter = (ParticleEmitter)body.AddComponent("MeshParticleEmitter");
                ParticleRender = body.AddComponent<ParticleRenderer>();
                ParticleAnim = body.AddComponent<ParticleAnimator>();
                ParticleRender.material = new Material(Shader.Find("Particles/Alpha Blended"));

                MainEmitter.useWorldSpace = false;
                ParticleAnim.doesAnimateColor = true;
            }
Ejemplo n.º 32
0
            /// <summary>
            /// The main initialisation. Here we create the subcomponents.
            /// </summary>
            void Awake()
            {
                if (!GetComponent<ParticleEmitter>())
                {
                    emitter = gameObject.AddComponent<MeshParticleEmitter>();
                    emitter.useWorldSpace = false;
                    emitter.emit = true;
                }
                else
                {
                    emitter = GetComponent<ParticleEmitter>();
                }

                if (!GetComponent<ParticleAnimator>())
                {
                    animator = gameObject.AddComponent<ParticleAnimator>();
                    animator.doesAnimateColor = true;
                }
                else
                {
                    animator = GetComponent<ParticleAnimator>();
                }

                if (!GetComponent<ParticleRenderer>())
                {
                    renderer = gameObject.AddComponent<ParticleRenderer>();
                    renderer.material = new Material(Shader.Find("Particles/Alpha Blended"));
                }
                else
                {
                    renderer = GetComponent<ParticleRenderer>();
                }

                filter = !GetComponent<MeshFilter>() ? gameObject.AddComponent<MeshFilter>() : GetComponent<MeshFilter>();
            }