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;
        }
 static public int constructor(IntPtr l)
 {
     UnityEngine.ParticleRenderer o;
     o = new UnityEngine.ParticleRenderer();
     pushObject(l, o);
     return(1);
 }
 static void ParticleRenderer_uvTiles(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         var result = _this.uvTiles;
         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.Rect[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.Rect[]>(() =>
         {
             int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
             int length  = JSApi.getArrayLength(jsObjID);
             var ret     = new UnityEngine.Rect[length];
             for (var i = 0; i < length; i++)
             {
                 JSApi.getElement(jsObjID, i);
                 ret[i] = (UnityEngine.Rect)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
             }
             return(ret);
         });
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         _this.uvTiles = arg0;
     }
 }
Пример #4
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;
        }
    }
    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();
        }
    }
Пример #6
0
 // Use this for initialization
 void Awake()
 {
     emitter = this.GetComponentInChildren<ParticleEmitter>();
     pRenderer = this.GetComponentInChildren<ParticleRenderer>();
     manager = GameObject.Find("GameManager").GetComponent<GameManager>();
     colors = manager.colors;
     partMaterials = manager.materials;
 }
 static public int set_uvTiles(IntPtr l)
 {
     UnityEngine.ParticleRenderer o = (UnityEngine.ParticleRenderer)checkSelf(l);
     UnityEngine.Rect[]           v;
     checkType(l, 2, out v);
     o.uvTiles = v;
     return(0);
 }
 static public int set_particleRenderMode(IntPtr l)
 {
     UnityEngine.ParticleRenderer   o = (UnityEngine.ParticleRenderer)checkSelf(l);
     UnityEngine.ParticleRenderMode v;
     checkEnum(l, 2, out v);
     o.particleRenderMode = v;
     return(0);
 }
 void Start()
 {
     particleSystem = GetComponent<ParticleRenderer>();
     //Change Foreground to the layer you want it to display on 
     //You could prob. make a public variable for this
     particleSystem.sortingLayerName = "CharacterFront";
     particleSystem.sortingOrder = 5;
 }
    static public int set_maxParticleSize(IntPtr l)
    {
        UnityEngine.ParticleRenderer o = (UnityEngine.ParticleRenderer)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.maxParticleSize = v;
        return(0);
    }
Пример #11
0
 // Use this for initialization
 void Start()
 {
     emitter = this.GetComponentInChildren<ParticleEmitter>();
     pRenderer = this.GetComponentInChildren<ParticleRenderer>();
     manager = GameObject.Find("GameManager");
     GameManager managerScript = manager.GetComponent<GameManager>();
     colors = managerScript.colors;
     partMaterials = managerScript.materials;
 }
    static public int set_cameraVelocityScale(IntPtr l)
    {
        UnityEngine.ParticleRenderer o = (UnityEngine.ParticleRenderer)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.cameraVelocityScale = v;
        return(0);
    }
Пример #13
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;
 }
    static public int set_uvAnimationCycles(IntPtr l)
    {
        UnityEngine.ParticleRenderer o = (UnityEngine.ParticleRenderer)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.uvAnimationCycles = v;
        return(0);
    }
Пример #15
0
    // Use this for initialization
    void Start()
    {
        StateEmiiter = StateBoard.GetComponent<ParticleEmitter>();
        StateEmiiter.emit = false;
        StateRenderer = StateBoard.GetComponent<ParticleRenderer>();
        All = new Material[3 ][ ];

            All[0] = English;
        All[1] = SC;
        All[2] = TC;
    }
Пример #16
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine("flareLightoff");

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

        Destroy(gameObject,flareTimer + 1f);
    }
Пример #17
0
	void Awake()
	{
		noise = new Perlin();
		
		oneOverZigs = 1f / (float) zigs;
		particleEmitter.emit = false;
		particleEmitter.maxEmission = zigs;
		particleEmitter.Emit(zigs);
		particles = particleEmitter.particles;
		_myParticleRenderer = GetComponent < ParticleRenderer > ();
	}	
Пример #18
0
 static public int get_particleRenderMode(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         pushEnum(l, (int)self.particleRenderMode);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #19
0
 static public int get_velocityScale(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         pushValue(l, self.velocityScale);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.ParticleRenderer o;
			o=new UnityEngine.ParticleRenderer();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int get_uvAnimationCycles(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.uvAnimationCycles);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_velocityScale(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.velocityScale);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_particleRenderMode(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.particleRenderMode);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.ParticleRenderer o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.ParticleRenderer();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer o;
         o = new UnityEngine.ParticleRenderer();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    void Start()
    {
        BallisticsSettings globalBallisticsSettings = GlobalSettings.Instance.ballisticsSettings;
        _terminalVelocity = globalBallisticsSettings.windVelocity + buoyancyVelocity;

        _position = transform.position;
        _localPosition = transform.localPosition;

        var particleAnimator = GetComponent<ParticleAnimator>();
        particleAnimator.force = 0.5f * (1 / particleAnimator.damping - 1) * _terminalVelocity;

        _particleRenderer = GetComponent<ParticleRenderer>();
    }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer o;
         o=new UnityEngine.ParticleRenderer();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Пример #28
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer o;
         o = new UnityEngine.ParticleRenderer();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #29
0
 static public int set_uvTiles(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         UnityEngine.Rect[]           v;
         checkType(l, 2, out v);
         self.uvTiles = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #30
0
 static public int set_particleRenderMode(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer   self = (UnityEngine.ParticleRenderer)checkSelf(l);
         UnityEngine.ParticleRenderMode v;
         checkEnum(l, 2, out v);
         self.particleRenderMode = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #31
0
 static public int set_velocityScale(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.velocityScale = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_particleRenderMode(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer   self = (UnityEngine.ParticleRenderer)checkSelf(l);
         UnityEngine.ParticleRenderMode v;
         checkEnum(l, 2, out v);
         self.particleRenderMode = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_velocityScale(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.velocityScale = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_uvTiles(IntPtr l)
 {
     try {
         UnityEngine.ParticleRenderer self = (UnityEngine.ParticleRenderer)checkSelf(l);
         UnityEngine.Rect[]           v;
         checkArray(l, 2, out v);
         self.uvTiles = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void ParticleRenderer_uvAnimationCycles(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         var result = _this.uvAnimationCycles;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         _this.uvAnimationCycles = arg0;
     }
 }
// fields

// properties
    static void ParticleRenderer_particleRenderMode(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
            var result = _this.particleRenderMode;
            JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
        }
        else
        {
            UnityEngine.ParticleRenderMode arg0  = (UnityEngine.ParticleRenderMode)JSApi.getEnum((int)JSApi.GetType.Arg);
            UnityEngine.ParticleRenderer   _this = (UnityEngine.ParticleRenderer)vc.csObj;
            _this.particleRenderMode = arg0;
        }
    }
 static void ParticleRenderer_uvAnimationYTile(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         var result = _this.uvAnimationYTile;
         JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
     }
     else
     {
         System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         _this.uvAnimationYTile = arg0;
     }
 }
 static void ParticleRenderer_cameraVelocityScale(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         var result = _this.cameraVelocityScale;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ParticleRenderer _this = (UnityEngine.ParticleRenderer)vc.csObj;
         _this.cameraVelocityScale = arg0;
     }
 }
Пример #39
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 int set_maxPartileSize(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.ParticleRenderer obj = (UnityEngine.ParticleRenderer)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.maxPartileSize = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index maxPartileSize on a nil value"));
        }
    }
    static int set_uvTiles(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.ParticleRenderer obj  = (UnityEngine.ParticleRenderer)o;
            UnityEngine.Rect[]           arg0 = ToLua.CheckStructArray <UnityEngine.Rect>(L, 2);
            obj.uvTiles = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index uvTiles on a nil value"));
        }
    }
	static int _CreateParticleRenderer(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

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

		return 0;
	}
    static int set_particleRenderMode(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.ParticleRenderer   obj  = (UnityEngine.ParticleRenderer)o;
            UnityEngine.ParticleRenderMode arg0 = (UnityEngine.ParticleRenderMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.ParticleRenderMode));
            obj.particleRenderMode = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index particleRenderMode on a nil value"));
        }
    }
    static int get_uvTiles(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.ParticleRenderer obj = (UnityEngine.ParticleRenderer)o;
            UnityEngine.Rect[]           ret = obj.uvTiles;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index uvTiles on a nil value"));
        }
    }
    static int get_maxPartileSize(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.ParticleRenderer obj = (UnityEngine.ParticleRenderer)o;
            float ret = obj.maxPartileSize;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index maxPartileSize on a nil value"));
        }
    }
Пример #46
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;
    }
    void CreateParticleSystem () 
    {
        GameObject  pSysGo     = new GameObject(vegetationName);
        string      emitterType = "MeshParticleEmitter";

        pSysGo.GetComponent<Transform>().parent = t;

        meshFilter = pSysGo.AddComponent<MeshFilter>();
        meshFilter.mesh = island.IslandMesh;

        pEmitter = (ParticleEmitter) pSysGo.AddComponent(emitterType);
        particleRenderer = pSysGo.AddComponent<ParticleRenderer>();

        particleRenderer.renderer.sharedMaterial = vegetationMaterial;
        particleRenderer.maxParticleSize = 0.01f;
        particleRenderer.particleRenderMode = ParticleRenderMode.VerticalBillboard;

        pEmitter.maxEmission = maxParticles;

        pEmitter.emit = false;
    }
Пример #48
0
    /// <summary>
    /// Unity functions.
    /// </summary>
    // Use this when the level is loaded
    void Awake()
    {
        // Set collision layer and game tag
        gameObject.layer = LayerMask.NameToLayer("Enemy");
        gameObject.tag = "Web";

        m_Touched = false;

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

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

        if ( audio )
        {
            audio.enabled = false;
        }

        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);
        HitSpeedReduction = Mathf.Clamp01(HitSpeedReduction);

        if ( AttractionRange == 0.0f || AttractionForce == 0.0f )
        {
            AttractionRange = 0.0f;
            AttractionForce = 0.0f;
        }
    }
	static int _CreateUnityEngine_ParticleRenderer(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 0)
			{
				UnityEngine.ParticleRenderer obj = new UnityEngine.ParticleRenderer();
				ToLua.Push(L, obj);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.ParticleRenderer.New");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Пример #50
0
 private void addComponents()
 {
     pEmitter = (ParticleEmitter)gameObject.AddComponent("MeshParticleEmitter");
     pRenderer = gameObject.AddComponent<ParticleRenderer>();
     pAnimator = gameObject.AddComponent<ParticleAnimator>();
 }
Пример #51
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"));
		}
	}
Пример #52
0
 void Start()
 {
     particleRenderer = GetComponent<ParticleRenderer>();
 }
    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();
        }
    }
Пример #54
0
    // Use this for initialization
    public void Awake()
    {
        if (CenterPoint == null)
            Debug.LogError ("No Center Point defined in Inspector");

        // Create Particle Emitter in Script
        _pe = (ParticleEmitter)gameObject.AddComponent <EllipsoidParticleEmitter>();
        _pe.emit = false;
        _pe.useWorldSpace = false;

        _pr = gameObject.AddComponent<ParticleRenderer> ();
        _pr.sharedMaterial = Blip;
        _pr.particleRenderMode = RenderMode;
        _pr.lengthScale = 0.0f;
        _pr.velocityScale = 1.0f;

        enabled = true;

        // Find our Layer based on the LayerMask from the Inspector
        int mask = (int)BlipLayer;

        if (!Mathf.IsPowerOfTwo (mask))
            Debug.LogError ("Please assign only one Layer to RadarSystem, your height lines will not be visible");

        bit = 0;
        while (((mask = mask>>1) & 0x1) == 0) {
            bit++;
        }

        bit += 1;

        if (OnPlane) {
            drawLineHeights = false;
        }
    }
        public SGenericParticleSystem(ParticleEmitter emitter, ParticleRenderer renderer, Particle[] particles)
        {
            if (emitter == null || renderer == null)
                return;

            instanceID = emitter.GetInstanceID();
            goInstanceID = emitter.gameObject.GetInstanceID();
            isLegacy = true;
            isWorldSpace = emitter.useWorldSpace;
            emit = emitter.emit;
            enabled = emitter.enabled;
            position = emitter.transform.position;
            name = emitter.gameObject.name;
            SetParticleRenderer(renderer);

            this.particles = new SGenericParticleArray(particles);
        }
        private void SetParticleRenderer(ParticleRenderer renderer)
        {
            if (renderer == null)
                return;

            this.renderer = new SParticleRenderer();
            SetMainCamPos();

            switch (renderer.particleRenderMode) {
                case ParticleRenderMode.Billboard: this.renderer.renderMode = SParticleRenderMode.Billboard; break;
                case ParticleRenderMode.HorizontalBillboard: this.renderer.renderMode = SParticleRenderMode.HorizontalBillboard; break;
                case ParticleRenderMode.SortedBillboard: this.renderer.renderMode = SParticleRenderMode.SortedBillboard; break;
                case ParticleRenderMode.Stretch: this.renderer.renderMode = SParticleRenderMode.Stretch; break;
                case ParticleRenderMode.VerticalBillboard: this.renderer.renderMode = SParticleRenderMode.VerticalBillboard; break;
            }

            this.renderer.cameraVelocityScale = renderer.cameraVelocityScale;
            this.renderer.lengthScale = renderer.lengthScale;
            this.renderer.velocityScale = renderer.velocityScale;
        }
Пример #57
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>();
                }
            }
Пример #58
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>();
        }
    }
Пример #59
0
	void Awake()
	{
		if(GetComponent<ParticleSystem>() == null)
			myPartRenderer = GetComponent<ParticleRenderer>();
	}
Пример #60
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);
        }