private Vector3 _tmpPos; //calculated position... randomized inside sphere of incoming radius * size

    #endregion Fields

    #region Methods

    public void Awake()
    {
        _particleEmitter = (gameObject.AddComponent<EllipsoidParticleEmitter>()) as ParticleEmitter;
        _particleRenderer = (gameObject.AddComponent<ParticleRenderer>()) as ParticleRenderer;
        _particleAnimator = (gameObject.AddComponent<ParticleAnimator>()) as ParticleAnimator;

        _particleRenderer.sortingLayerName = "Topmost";

        _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();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Unity functions.
    /// </summary>
    // Use this when the level is loaded
    void Awake()
    {
        particleAnimator = GetComponent<ParticleAnimator>();
        particleRenderer = GetComponent<ParticleRenderer>();

        if (particleAnimator)
        {
            particleAnimator.autodestruct = true;
        }

        // Set the player layer
        gameObject.layer = LayerMask.NameToLayer("Enemy");

        CollisionScale = Mathf.Clamp01(CollisionScale);
        AttractionRange = Mathf.Max(0.0f,AttractionRange);
        AttractionForce = Mathf.Clamp01(AttractionForce);
        AttackSpeed = Mathf.Max(0.0f,AttackSpeed);
        ForceStep = Mathf.Max(0.0f,ForceStep);
        Damage = Mathf.Max(0.0f,Damage);
        DyingFactor = Mathf.Clamp01(DyingFactor);

        if ( AttractionRange == 0.0f || AttractionForce == 0.0f )
        {
            AttractionRange = 0.0f;
            AttractionForce = 0.0f;
        }
    }
 static void ParticleAnimator_colorAnimation(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         var result = _this.colorAnimation;
         var arrRet = result;
         for (int i = 0; arrRet != null && i < arrRet.Length; i++)
         {
             JSMgr.datax.setObject((int)JSApi.SetType.SaveAndTempTrace, arrRet[i]);
             JSApi.moveSaveID2Arr(i);
         }
         JSApi.setArrayS((int)JSApi.SetType.Rval, (arrRet != null ? arrRet.Length : 0), true);
     }
     else
     {
         UnityEngine.Color[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.Color[]>(() =>
         {
             int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
             int length  = JSApi.getArrayLength(jsObjID);
             var ret     = new UnityEngine.Color[length];
             for (var i = 0; i < length; i++)
             {
                 JSApi.getElement(jsObjID, i);
                 ret[i] = (UnityEngine.Color)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
             }
             return(ret);
         });
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         _this.colorAnimation = arg0;
     }
 }
Exemplo n.º 4
0
    /*			METHODES			*/
    //Constructor
    void Awake()
    {
        // A retenir : GemLight = gameObject.AddComponent("Light") as Light;

        //Lien avec les composants des particules
        GemPartEmitter = GetComponent<ParticleEmitter>();												//Lien avec l'Emitter des particules
        GemPartAnimation = GetComponent<ParticleAnimator>();											//Lien avec l'Animator des particules
        //GemPartRenderer = GetComponent<ParticleRenderer>();											//Lien avec le Renderer des particules
        InitialColor = Color.yellow;																	//Définition de la couleur initiale de la Gemme
        OppositeColor = Color.magenta;																	//Définition de la couleur opposé de la Gemme

        //Initialisation du tableau dynamiquement
        GemPartStarkle = new Color[5];																	//Initialisation des 5 couleurs comosant le Renderer

        //Lien avec la Lumière
        GemLight = GetComponent<Light>();

        GemTitle = GameObject.Find("GUI Text");															//Lien avec le GUIText de la scène

        //Initialisation des statuts
        GemPartEmitter.emit = false;																	//Dissimulation des particules
        GemTitle.guiText.enabled = false;																//Dissimulation du texte

        MyPart = (ParticleSystem) Instantiate(test);
        ChangeMode = false;
    }
Exemplo n.º 5
0
    /*			METHODES			*/
    //Constructor
    void Awake()
    {
        //Lien avec les composants des particules
        GemPartEmitter = GetComponent<ParticleEmitter>();												//Lien avec l'Emitter des particules
        GemPartAnimation = GetComponent<ParticleAnimator>();											//Lien avec l'Animator des particules
        InitialColor = Color.magenta;																	//Définition de la couleur initiale de la Gemme
        OppositeColor = new Color32(255,132,0,255);														//Définition de la couleur opposé de la Gemme

        //Initialisation du tableau dynamiquement
        GemPartStarkle = new Color[5];																	//Initialisation des 5 couleurs comosant le Renderer

        //Lien avec la Lumière
        GemLight = GetComponent<Light>();

        GemTitle = GameObject.Find("Title").GetComponent<TextMesh>();									//Lien avec le GUIText de la scène

        //Initialisation des statuts
        GemPartEmitter.emit = false;																	//Dissimulation des particules
        GemTitle.renderer.enabled = false;																//Dissimulation du texte

        ChangeMode = false;
                                                                                                        //Récuparation des scripts
        Blue = GameObject.FindGameObjectWithTag("Blue").GetComponent<BlueGem>();
        Yellow = GameObject.FindGameObjectWithTag("Yellow").GetComponent<YellowGem>();
        White = GameObject.FindGameObjectWithTag("White").GetComponent<WhiteGem>();
        Black = GameObject.FindGameObjectWithTag("Black").GetComponent<BlackGem>();
        Red = GameObject.FindGameObjectWithTag("Red").GetComponent<RedGem>();
    }
Exemplo n.º 6
0
    // --------------------------------------------------------------------------------------
    // Legacy Only...
    public static void ConvertToStaticScale(ParticleEmitter pe, ParticleAnimator pa)
    {
        if (pe == null)
            return;

        Vector3 vecVelScale	= (pe.transform.lossyScale);
        float fVelScale		= (NcTransformTool.GetTransformScaleMeanValue(pe.transform));
        float fScale		= (NcTransformTool.GetTransformScaleMeanValue(pe.transform));

        pe.minSize					*= fScale;
        pe.maxSize					*= fScale;

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

        if (pa != null)
        {
            pa.rndForce					=  Vector3.Scale(pa.rndForce, vecVelScale);
            pa.force					=  Vector3.Scale(pa.force, vecVelScale);
        //			pa.damping					*= fScale;
        }
        Vector3		ellipsoid;
        float		minEmitterRange;

        NgSerialized.GetEllipsoidSize(pe, out ellipsoid, out minEmitterRange);
        NgSerialized.SetEllipsoidSize(pe, ellipsoid * fScale, minEmitterRange * fScale);
        // 		NgAssembly.LogFieldsPropertis(pe);
    }
 static public int constructor(IntPtr l)
 {
     UnityEngine.ParticleAnimator o;
     o = new UnityEngine.ParticleAnimator();
     pushObject(l, o);
     return(1);
 }
        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;
        }
Exemplo n.º 9
0
 static public int set_colorAnimation(IntPtr l)
 {
     UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
     UnityEngine.Color[]          v;
     checkType(l, 2, out v);
     o.colorAnimation = v;
     return(0);
 }
Exemplo n.º 10
0
 static public int set_localRotationAxis(IntPtr l)
 {
     UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
     UnityEngine.Vector3          v;
     checkType(l, 2, out v);
     o.localRotationAxis = v;
     return(0);
 }
Exemplo n.º 11
0
 static public int set_force(IntPtr l)
 {
     UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
     UnityEngine.Vector3          v;
     checkType(l, 2, out v);
     o.force = v;
     return(0);
 }
Exemplo n.º 12
0
    static public int set_autodestruct(IntPtr l)
    {
        UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.autodestruct = v;
        return(0);
    }
Exemplo n.º 13
0
    static public int set_doesAnimateColor(IntPtr l)
    {
        UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.doesAnimateColor = v;
        return(0);
    }
Exemplo n.º 14
0
    static public int set_sizeGrow(IntPtr l)
    {
        UnityEngine.ParticleAnimator o = (UnityEngine.ParticleAnimator)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.sizeGrow = v;
        return(0);
    }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.ParticleAnimator o;
			o=new UnityEngine.ParticleAnimator();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Exemplo n.º 16
0
 static public int get_localRotationAxis(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.localRotationAxis);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_localRotationAxis(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         pushValue(l, self.localRotationAxis);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 18
0
    void getRequiredComponents()
    {
        pe = gameObject.GetComponent<ParticleEmitter>();
        if (pe == null) {
            throw new System.Exception("This script can only be used if the gameobject has a ParticleEmitter");
        }

        pa = gameObject.GetComponent<ParticleAnimator>();
        if (pa == null) {
            throw new System.Exception("This script can only be used if the gameobject has a ParticleAnimator");
        }
    }
Exemplo n.º 19
0
 static public int get_autodestruct(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.autodestruct);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 20
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator o;
         o = new UnityEngine.ParticleAnimator();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 21
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.ParticleAnimator o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.ParticleAnimator();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Exemplo n.º 22
0
	void StartBirds()
	{
//		transform.position = new Vector3( ((Random.Range(0,2)*2)-1) * Random.Range(65f, 80f), transform.position.y, Random.Range(-30f, -20f));
//		transform.LookAt(new Vector3(0, transform.position.y, Random.Range(-80f, -50f)) );
		
		Transform birds = (Transform)Instantiate(birdsPrefab, transform.position, transform.rotation);
		animator = birds.GetComponentInChildren(typeof(ParticleAnimator)) as ParticleAnimator;
		animator.force = new Vector3(0, Random.Range(-0.3f, 0.3f), 0);
		emitter = birds.GetComponentInChildren(typeof(ParticleEmitter)) as ParticleEmitter;
		emitter.emit = true;
		
		birdTimer = Time.time + Random.Range(5,20);
	}
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator o;
         o = new UnityEngine.ParticleAnimator();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator o;
         o=new UnityEngine.ParticleAnimator();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static public int set_colorAnimation(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         UnityEngine.Color[]          v;
         checkArray(l, 2, out v);
         self.colorAnimation = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_doesAnimateColor(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.doesAnimateColor = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 27
0
 static public int set_sizeGrow(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.sizeGrow = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 28
0
 static public int set_localRotationAxis(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         UnityEngine.Vector3          v;
         checkType(l, 2, out v);
         self.localRotationAxis = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_localRotationAxis(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         UnityEngine.Vector3          v;
         checkType(l, 2, out v);
         self.localRotationAxis = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 30
0
 static public int set_doesAnimateColor(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.doesAnimateColor = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_sizeGrow(IntPtr l)
 {
     try {
         UnityEngine.ParticleAnimator self = (UnityEngine.ParticleAnimator)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.sizeGrow = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static void ParticleAnimator_localRotationAxis(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         var result = _this.localRotationAxis;
         JSApi.setVector3S((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.Vector3          arg0  = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg);
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         _this.localRotationAxis = arg0;
     }
 }
// fields

// properties
    static void ParticleAnimator_doesAnimateColor(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
            var result = _this.doesAnimateColor;
            JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
        }
        else
        {
            System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
            UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
            _this.doesAnimateColor = arg0;
        }
    }
Exemplo n.º 34
0
    /// <summary>
    /// Unity functions.
    /// </summary>
    // Use this when the level is loaded
    protected override void Awake()
    {
        base.Awake();

        particleAnimator = GetComponent<ParticleAnimator>();
        particleRenderer = GetComponent<ParticleRenderer>();

        if (particleAnimator)
        {
            particleAnimator.autodestruct = true;
        }

        // Set the player layer
        gameObject.layer = LayerMask.NameToLayer("Enemy");
    }
 static void ParticleAnimator_sizeGrow(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         var result = _this.sizeGrow;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ParticleAnimator _this = (UnityEngine.ParticleAnimator)vc.csObj;
         _this.sizeGrow = arg0;
     }
 }
    static int set_doesAnimateColor(IntPtr L)
    {
        UnityEngine.ParticleAnimator obj = (UnityEngine.ParticleAnimator)ToLua.ToObject(L, 1);
        bool arg0 = LuaDLL.luaL_checkboolean(L, 2);

        try
        {
            obj.doesAnimateColor = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index doesAnimateColor on a nil value" : e.Message));
        }

        return(0);
    }
    static int set_localRotationAxis(IntPtr L)
    {
        UnityEngine.ParticleAnimator obj  = (UnityEngine.ParticleAnimator)ToLua.ToObject(L, 1);
        UnityEngine.Vector3          arg0 = ToLua.ToVector3(L, 2);

        try
        {
            obj.localRotationAxis = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index localRotationAxis on a nil value" : e.Message));
        }

        return(0);
    }
    static int set_sizeGrow(IntPtr L)
    {
        UnityEngine.ParticleAnimator obj = (UnityEngine.ParticleAnimator)ToLua.ToObject(L, 1);
        float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);

        try
        {
            obj.sizeGrow = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index sizeGrow on a nil value" : e.Message));
        }

        return(0);
    }
    static int get_doesAnimateColor(IntPtr L)
    {
        UnityEngine.ParticleAnimator obj = (UnityEngine.ParticleAnimator)ToLua.ToObject(L, 1);
        bool ret;

        try
        {
            ret = obj.doesAnimateColor;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index doesAnimateColor on a nil value" : e.Message));
        }

        LuaDLL.lua_pushboolean(L, ret);
        return(1);
    }
    static int _CreateUnityEngine_ParticleAnimator(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            UnityEngine.ParticleAnimator obj = new UnityEngine.ParticleAnimator();
            ToLua.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.ParticleAnimator.New");
        }

        return(0);
    }
Exemplo n.º 41
0
    private float range; //.2f

    #endregion Fields

    #region Methods

    //----------------- Variables end ----------------------------------//
    void Awake()
    {
        myTransform = transform;
        // Ignore bullet colliding with Player
        Physics.IgnoreLayerCollision(8, 9);
        // Ignore bullet colliding with bullet
        Physics.IgnoreLayerCollision(8, 8);
        bulletSpeed = 40;
        bulletLife = 4;
        range = 0.5f;
        alreadyhitsomething = false;
        isbullet1 = false;
        isbullet2 = false;
        particleAnimator = bulletexplosion.GetComponent<ParticleAnimator>();
        particleemitter = bulletexplosion.GetComponent<ParticleEmitter>();
        particleForce = new Vector3(0, 0, 0);
    }
    static int get_colorAnimation(IntPtr L)
    {
        UnityEngine.ParticleAnimator obj = (UnityEngine.ParticleAnimator)ToLua.ToObject(L, 1);
        UnityEngine.Color[]          ret = null;

        try
        {
            ret = obj.colorAnimation;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index colorAnimation on a nil value" : e.Message));
        }

        ToLua.Push(L, ret);
        return(1);
    }
	static int _CreateParticleAnimator(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 0)
		{
			ParticleAnimator obj = new ParticleAnimator();
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: ParticleAnimator.New");
		}

		return 0;
	}
Exemplo n.º 44
0
    /// <summary>
    /// Unity functions.
    /// </summary>
    // Use this when the level is loaded
    void Awake()
    {
        particleAnimator = GetComponent<ParticleAnimator>();
        particleRenderer = GetComponent<ParticleRenderer>();

        //sphereCollider = GetComponent<SphereCollider>();
        if (particleEmitter && particleRenderer && particleAnimator)
        {
            particleEmitter.enabled = true;
            particleEmitter.emit = false;
            particleEmitter.useWorldSpace = false;

            particleAnimator.autodestruct = false;
            particleAnimator.doesAnimateColor = false;
        }

        // Deactivate the audio source
        if ( audio )
        {
            audio.enabled = false;
        }

        // Set the player layer
        gameObject.layer = LayerMask.NameToLayer("Enemy");

        CollisionScale = Mathf.Clamp01(CollisionScale);
        AttractionRange = Mathf.Max(0.0f,AttractionRange);
        AttractionForce = Mathf.Clamp01(AttractionForce);
        AttackSpeed = Mathf.Max(0.0f,AttackSpeed);
        ForceStep = Mathf.Max(0.0f,ForceStep);
        Damage = Mathf.Max(0.0f,Damage);
        DyingFactor = Mathf.Clamp01(DyingFactor);
        HitSpeedReduction = Mathf.Clamp01(HitSpeedReduction);

        if ( AttractionRange == 0.0f || AttractionForce == 0.0f )
        {
            AttractionRange = 0.0f;
            AttractionForce = 0.0f;
        }

        m_Touched = false;
    }
Exemplo n.º 45
0
    /*			METHODES			*/
    //Constructor
    void Awake()
    {
        //Lien avec les composants des particules
        GemPartEmitter = GetComponent<ParticleEmitter>();												//Lien avec l'Emitter des particules
        GemPartAnimation = GetComponent<ParticleAnimator>();											//Lien avec l'Animator des particules
        InitialColor = Color.magenta;																	//Définition de la couleur initiale de la Gemme
        OppositeColor = new Color32(255,132,0,255);														//Définition de la couleur opposé de la Gemme

        //Initialisation du tableau dynamiquement
        GemPartStarkle = new Color[5];																	//Initialisation des 5 couleurs comosant le Renderer

        //Lien avec la Lumière
        GemLight = GetComponent<Light>();

        GemTitle = GameObject.Find("Title").GetComponent<TextMesh>();									//Lien avec le GUIText de la scène

        //Initialisation des statuts
        GemPartEmitter.emit = false;																	//Dissimulation des particules
        GemTitle.renderer.enabled = false;																//Dissimulation du texte
    }
	static int _CreateUnityEngine_ParticleAnimator(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 0)
			{
				UnityEngine.ParticleAnimator obj = new UnityEngine.ParticleAnimator();
				ToLua.Push(L, obj);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.ParticleAnimator.New");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Exemplo n.º 47
0
	public override void OnSetReplayState()
	{
		base.OnSetReplayState();
		m_pe = GetComponent<ParticleEmitter>();
		m_pa = GetComponent<ParticleAnimator>();
		if (m_pa != null)
			m_pa.autodestruct	= false;
	}
Exemplo n.º 48
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        leftCollider = GameObject.Find("Left").transform;
        rightCollider = GameObject.Find("Right").transform;

        destroy_threshold = GameObject.Find("Down").transform.position.y;
        //spriteRenderer = transform.GetChild(0).GetComponent<SpriteRenderer>();
        sphereCollider = GetComponent<SphereCollider>();
        rotationScript = GetComponent<RotationScript>();

        burstParticlesParent = GameObject.Find("BurstParticlesParent");

        burstParticleInstance = Instantiate(burstParticle, new Vector3(10000,10000,1), Quaternion.identity) as GameObject;
        burstParticleInstance.transform.SetParent(burstParticlesParent.transform);
        particleAnim = burstParticleInstance.GetComponent<ParticleAnimator>();
        particleAnim.autodestruct = false;
        particleEmit = burstParticleInstance.GetComponent<ParticleEmitter>();
        particleEmit.emit = false;

        scoresParent = GameObject.Find("ScoresParent");

        if(name!="DummyBall(Clone)"){
            scoreInstance = Instantiate(scorePrefab, new Vector3(10,10,1), Quaternion.identity) as GameObject;
            scoreInstance.transform.SetParent(scoresParent.transform);
            scoreInstance.transform.localScale = new Vector3(1,1,1);
            scoreText = scoreInstance.GetComponent<Text>();
            //textMesh = scoreInstance.GetComponent<TextMesh>();
            //textMesh.renderer.sortingLayerName = "MiddleLayer";
            scoreLife = Random.Range(0.3f, 0.8f);
        }
    }
Exemplo n.º 49
0
	// Loop Function --------------------------------------------------------------------
	void Awake()
	{
// 		particleEmitter.emit = false;
		if (IsShuriken())
		{
			m_ps = GetComponent<ParticleSystem>();
		} else {
			m_pe = GetComponent<ParticleEmitter>();
			m_pa = GetComponent<ParticleAnimator>();
			m_pr = GetComponent<ParticleRenderer>();

			if (m_pe != null)
				m_bMeshParticleEmitter	= (m_pe.ToString().Contains("MeshParticleEmitter"));
		}
	}
Exemplo n.º 50
0
 /// <summary>Defines the particle effects used in this module.</summary>
 public void SetupParticles(bool repulsor)
 {
     if (!KFPersistenceManager.isDustEnabled)
         return;
     kfdustFx = (GameObject)GameObject.Instantiate(Resources.Load(dustEffectObject));
     kfdustFx.transform.position = part.transform.position;
     kfdustFx.particleEmitter.localVelocity = Vector3.zero;
     kfdustFx.particleEmitter.useWorldSpace = true;
     kfdustFx.particleEmitter.emit = false;
     kfdustFx.particleEmitter.minEnergy = minDustEnergy;
     kfdustFx.particleEmitter.minEmission = minDustEmission;
     kfdustFx.particleEmitter.minSize = minDustSize;
     dustAnimator = kfdustFx.particleEmitter.GetComponent<ParticleAnimator>();
     if (repulsor) // this needs to be run whether the lights are enabled or not, or the lights wont' work properly if switched on in flight
         SetupRepulsorLights();
 }
Exemplo n.º 51
0
 // Use this for initialization
 void Awake()
 {
     Duration = 0f;
     Timer = 0f;
     LocalScale = 0f;
     _particleAnimator = transform.GetComponentInChildren<ParticleAnimator>();
 }
Exemplo n.º 52
0
 private void addComponents()
 {
     pEmitter = (ParticleEmitter)gameObject.AddComponent("MeshParticleEmitter");
     pRenderer = gameObject.AddComponent<ParticleRenderer>();
     pAnimator = gameObject.AddComponent<ParticleAnimator>();
 }
Exemplo n.º 53
0
            /// <summary>
            /// The main initialisation. Here we create the subcomponents.
            /// </summary>
            void Awake()
            {
                if (!GetComponent<ParticleEmitter>())
                {
                    emitter = (ParticleEmitter)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>();
                }

                if (!GetComponent<MeshFilter>())
                {
                    filter = gameObject.AddComponent<MeshFilter>();
                }
                else
                {
                    filter = GetComponent<MeshFilter>();
                }
            }
    private Vector3 _tmpPos; //calculated position... randomized inside sphere of incoming radius * size

    #endregion Fields

    #region Methods

    public void Awake()
    {
        //		GameObject g = GameObject.Find("/ParticleHelper");
        //		ParticleEmitter pe = g.GetComponent<ParticleEmitter>();

        //        _particleEmitter = (gameObject.AddComponent("EllipsoidParticleEmitter")) as ParticleEmitter;
        //        _particleRenderer = (gameObject.AddComponent("ParticleRenderer")) as ParticleRenderer;
        //        _particleAnimator = (gameObject.AddComponent("ParticleAnimator")) as ParticleAnimator;
        //        _particleEmitter = gameObject.AddComponent(pe.GetType()) as ParticleEmitter;
        //		_particleEmitter = gameObject.GetComponent("EllipsoidParticleEmitter") as ParticleEmitter;
        //		_particleEmitter.enabled = true;
        _particleEmitter = gameObject.GetComponent<ParticleEmitter>();
        _particleRenderer = gameObject.AddComponent<ParticleRenderer>();
        _particleAnimator = gameObject.AddComponent<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();
        }
    }
Exemplo n.º 55
0
        /*private string[] particleTypes = {
                                            "fx_exhaustFlame_white_tiny",
                                            "fx_exhaustFlame_yellow",
                                            "fx_exhaustFlame_blue",
                                            //"fx_exhaustLight_yellow",
                                            "fx_exhaustLight_blue",
                                            "fx_exhaustFlame_blue_small",
                                            "fx_smokeTrail_light",
                                            "fx_smokeTrail_medium",
                                            "fx_smokeTrail_large",
                                            "fx_smokeTrail_veryLarge",
                                            "fx_smokeTrail_aeroSpike",
                                            "fx_gasBurst_white",
                                            "fx_gasJet_white",
                                            "fx_SRB_large_emit",
                                            "fx_SRB_large_emit2",
                                            "fx_exhaustSparks_flameout",
                                            "fx_exhaustSparks_flameout_2",
                                            "fx_exhaustSparks_yellow",
                                            "fx_shockExhaust_red_small", nope
                                            "fx_shockExhaust_blue_small",
                                            "fx_shockExhaust_blue",
                                            "fx_LES_emit",
                                            "fx_ksX_emit",
                                            "fx_ks25_emit",
                                            "fx_ks1_emit"
                                         };*/
        //int currentParticle = 0;
        private void SetupParticles()
        {
            /*UnityEngine.Object o = null;
            while (o == null)
            {
                string name = "Effects/" + particleTypes[currentParticle];
                Debug.Log("Attempting to load " + name);
                o = UnityEngine.Resources.Load(name);
                currentParticle++;
                if (currentParticle >= particleTypes.Length) currentParticle = 0;
            }*/

            //ScreenMessages.PostScreenMessage(particleTypes[currentParticle]);
            if (scrapeSparks)
            {
                sparkFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustSparks_flameout"));
                sparkFx.transform.parent = part.transform;
                sparkFx.transform.position = part.transform.position;
                sparkFx.particleEmitter.localVelocity = Vector3.zero;
                sparkFx.particleEmitter.useWorldSpace = true;
                sparkFx.particleEmitter.emit = false;
                sparkFx.particleEmitter.minEnergy = 0;
                sparkFx.particleEmitter.minEmission = 0;
            }

            dustFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_smokeTrail_light"));
            dustFx.transform.parent = part.transform;
            dustFx.transform.position = part.transform.position;
            dustFx.particleEmitter.localVelocity = Vector3.zero;
            dustFx.particleEmitter.useWorldSpace = true;
            dustFx.particleEmitter.emit = false;
            dustFx.particleEmitter.minEnergy = 0;
            dustFx.particleEmitter.minEmission = 0;
            dustAnimator = dustFx.particleEmitter.GetComponent<ParticleAnimator>();

            /*fragmentFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustSparks_yellow"));
            fragmentFx.transform.parent = part.transform;
            fragmentFx.transform.position = part.transform.position;
            fragmentFx.particleEmitter.localVelocity = Vector3.zero;
            fragmentFx.particleEmitter.useWorldSpace = true;
            fragmentFx.particleEmitter.emit = false;
            fragmentFx.particleEmitter.minEnergy = 0;
            fragmentFx.particleEmitter.minEmission = 0;
            fragmentAnimator = fragmentFx.particleEmitter.GetComponent<ParticleAnimator>();*/
        }
Exemplo n.º 56
0
    // Use this when the level is loaded
    protected override void Awake()
    {
        base.Awake();

        particleAnimator = GetComponent<ParticleAnimator>();
        particleRenderer = GetComponent<ParticleRenderer>();

        // Set the player layer
        gameObject.layer = LayerMask.NameToLayer("Player");

        // We want this object to be persistent across the levels
        Object.DontDestroyOnLoad( this );

        // Spawn the finger
        Spawn();
    }
Exemplo n.º 57
0
    /// <summary>
    /// Unity functions.
    /// </summary>
    // Use this when the level is loaded
    void Awake()
    {
        // Set layer and tag
        gameObject.layer = LayerMask.NameToLayer("Enemy");
        gameObject.tag = "Spawnable";

        m_IsActive = false;
        m_Glowing = false;
        m_Blowing = false;

        m_AnimationTime = 0.0f;
        m_ElapesedTime = 0.0f;

        particleAnimator = GetComponent<ParticleAnimator>();
        particleRenderer = GetComponent<ParticleRenderer>();
        if (particleEmitter && particleAnimator && particleRenderer)
        {
            particleEmitter.enabled = false;
            particleEmitter.emit = false;
            particleEmitter.useWorldSpace = false;

            particleEmitter.minEnergy = particleEmitter.maxEnergy;
            particleEmitter.minEmission = particleEmitter.maxEmission;
            m_InitialParticleSize = particleEmitter.minSize = particleEmitter.maxSize;

            particleAnimator.autodestruct = false;
            particleAnimator.doesAnimateColor = false;

            m_AnimationTime = particleEmitter.maxEnergy / particleRenderer.uvAnimationCycles;

            m_SpawnTexture = particleRenderer.material.mainTexture;

            //m_InitialColor = particleRenderer.material.GetColor("_TintColor");
            //if (m_InitialColor.a == 0.0f)
            {
                m_InitialColor = Color.black;
            }
        }

        // Every spawnable has to be child of an useful.
        if (transform.parent)
        {
            m_AttachedUseful = transform.parent.GetComponent<Useful>();
        }
    }
Exemplo n.º 58
0
 void Start()
 {
     pa = GetComponent<ParticleAnimator>();
 }
Exemplo n.º 59
0
        public void Setup()
        {
            if (part.partInfo == null) { return; }
            if (obj != null) { return; }

            var shaderName = config.GetValue("ShaderName");
            var textureName = config.GetValue("TextureName");

            obj = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            obj.collider.enabled = false;
            obj.renderer.material.color = new Color(0, 0, 0, 0);
            obj.renderer.material.shader = Shader.Find("Transparent/Diffuse");
            obj.transform.parent = part.transform;
            obj.transform.localRotation = Quaternion.identity;

            animator = (ParticleAnimator)obj.AddComponent<ParticleAnimator>();
            emitter = (ParticleEmitter)obj.AddComponent("MeshParticleEmitter");
            renderer = (ParticleRenderer)obj.AddComponent<ParticleRenderer>();

            var material = new Material(Shader.Find(shaderName));
            material.mainTexture = GameDatabase.Instance.GetTexture(textureName, false);
            material.color = Color.white;

            renderer.materials = new Material[] { material };
            animator.colorAnimation = new Color[5];

            if (Misc.Parse(config.GetValue("Collision"), false))
            {
                obj.AddComponent("WorldParticleCollider");
            }

            AngularVelocity         = Misc.Parse(config.GetValue("AngularVelocity"), 0f);
            CameraVelocityScale     = Misc.Parse(config.GetValue("CameraVelocityScale"), 0f);
            ColorAnimation1         = ConfigNode.ParseColor(config.GetValue("ColorAnimation1"));
            ColorAnimation2         = ConfigNode.ParseColor(config.GetValue("ColorAnimation2"));
            ColorAnimation3         = ConfigNode.ParseColor(config.GetValue("ColorAnimation3"));
            ColorAnimation4         = ConfigNode.ParseColor(config.GetValue("ColorAnimation4"));
            ColorAnimation5         = ConfigNode.ParseColor(config.GetValue("ColorAnimation5"));
            Damping                 = Misc.Parse(config.GetValue("Damping"), 1f);
            Emit                    = Misc.Parse(config.GetValue("Emit"), true);
            EmitterVelocityScale    = Misc.Parse(config.GetValue("EmitterVelocityScale"), 1f);
            Force                   = Misc.Parse(config.GetValue("Force"), Vector3.zero);
            LengthScale             = Misc.Parse(config.GetValue("LengthScale"), 1f);
            LocalRotationAxis       = Misc.Parse(config.GetValue("LocalRotationAxis"), Vector3.zero);
            LocalVelocity           = Misc.Parse(config.GetValue("LocalVelocity"), Vector3.zero);
            MaxEmission             = Misc.Parse(config.GetValue("MaxEmission"), 0f);
            MaxEnergy               = Misc.Parse(config.GetValue("MaxEnergy"), 0f);
            MaxParticleSize         = Misc.Parse(config.GetValue("MaxParticleSize"), 0f);
            MaxSize                 = Misc.Parse(config.GetValue("MaxSize"), 0f);
            MinEmission             = Misc.Parse(config.GetValue("MinEmission"), 0f);
            MinEnergy               = Misc.Parse(config.GetValue("MinEnergy"), 0f);
            MinSize                 = Misc.Parse(config.GetValue("MinSize"), 0f);
            RandomAngularVelocity   = Misc.Parse(config.GetValue("RandomAngularVelocity"), 0f);
            RandomForce             = Misc.Parse(config.GetValue("RandomForce"), Vector3.zero);
            RandomRotation          = Misc.Parse(config.GetValue("RandomRotation"), false);
            RandomVelocity          = Misc.Parse(config.GetValue("RandomVelocity"), Vector3.zero);
            RenderMode              = Misc.Parse(config.GetValue("RenderMode"), ParticleRenderMode.Billboard);
            SizeGrow                = Misc.Parse(config.GetValue("SizeGrow"), 0f);
            UseWorldSpace           = Misc.Parse(config.GetValue("UseWorldSpace"), false);
            VelocityScale           = Misc.Parse(config.GetValue("VelocityScale"), 0f);
            WorldRotationAxis       = Misc.Parse(config.GetValue("WorldRotationAxis"), Vector3.zero);
            WorldVelocity           = Misc.Parse(config.GetValue("WorldVelocity"), Vector3.zero);

            EmitterPosition         = Misc.Parse(config.GetValue("EmitterPosition"), Vector3.zero);
            EmitterScale            = Misc.Parse(config.GetValue("EmitterScale"), Vector3.zero);
        }
Exemplo n.º 60
0
 /// <summary>Defines the particle effects used in this module.</summary>
 public void SetupParticles(bool repulsor)
 {
     kfdustFx = (GameObject)GameObject.Instantiate(Resources.Load(dustEffectObject));
     kfdustFx.transform.position = part.transform.position;
     kfdustFx.particleEmitter.localVelocity = Vector3.zero;
     kfdustFx.particleEmitter.useWorldSpace = true;
     kfdustFx.particleEmitter.emit = false;
     kfdustFx.particleEmitter.minEnergy = minDustEnergy;
     kfdustFx.particleEmitter.minEmission = minDustEmission;
     kfdustFx.particleEmitter.minSize = minDustSize;
     dustAnimator = kfdustFx.particleEmitter.GetComponent<ParticleAnimator>();
     if (repulsor)
         SetupRepulsorLights();
 }