• 大小: 0.03M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: unity  粒子  效果  

资源简介

unity中粒子系统的粒子,完整样例,来自unity官方指定用书第五章光盘自带例子。粒子特效能够为游戏增添交互与响应能力,它们擅长创造许多运动和撞击效果。粒子特效可用于创建魔法火球,漩涡状的空间传送门,或者将玩家的注意力引导到一个发光的宝箱。炫酷的视觉效果往往引人入胜。

资源截图

代码片段和文件信息

using UnityEngine;
using System.Collections;

public class scriptOnCollider : MonoBehaviour
{
    private ParticleCollisionEvent[] collisionEvents = new ParticleCollisionEvent[16];

    void Start()
    {
    }

    void Update()
    {

    }

    // OnParticleCollision在Collider所属游戏对象脚本上执行,other为ParticleSystem所属游戏对象
    void OnParticleCollision(Gameobject other)
    {
        ParticleSystem ps = other.GetComponent();
        int safeLength = ps.GetSafeCollisionEventSize();
        print(“safe length = “ + safeLength.ToString());
        if(collisionEvents.Length < safeLength)
            collisionEvents = new ParticleCollisionEvent[safeLength];
        int num = ps.GetCollisionEvents(gameobject collisionEvents);
        print(“received collision 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3517  2015-01-15 11:00  Assembly-CSharp-vs.csproj
     文件        3517  2015-01-15 11:00  Assembly-CSharp.csproj
     目录           0  2015-01-15 12:19  Assets\
     文件       53284  2015-01-15 12:19  Assets\Main.unity
     文件         110  2014-07-15 22:03  Assets\Main.unity.meta
     文件        1552  2014-07-17 22:15  Assets\scriptOnCollider.cs
     文件         198  2014-07-15 22:05  Assets\scriptOnCollider.cs.meta
     文件         743  2014-07-17 22:15  Assets\scriptOnParticle.cs
     文件         198  2014-07-15 22:04  Assets\scriptOnParticle.cs.meta
     文件        1911  2015-01-15 11:00  ParticleTest-csharp.sln
     文件        1907  2015-01-15 11:00  ParticleTest.sln
     文件         744  2014-08-03 15:38  ParticleTest.userprefs
     目录           0  2015-01-15 12:18  ProjectSettings\
     文件        4125  2014-07-15 21:59  ProjectSettings\AudioManager.asset
     文件        4276  2014-07-15 21:59  ProjectSettings\DynamicsManager.asset
     文件        4104  2014-07-15 21:59  ProjectSettings\EditorBuildSettings.asset
     文件        4184  2014-07-15 21:59  ProjectSettings\EditorSettings.asset
     文件        4160  2014-07-15 21:59  ProjectSettings\GraphicsSettings.asset
     文件        5252  2014-07-15 21:59  ProjectSettings\InputManager.asset
     文件        4384  2014-07-15 21:59  ProjectSettings\NavMeshAreas.asset
     文件        4112  2014-07-15 21:59  ProjectSettings\NetworkManager.asset
     文件        4300  2014-07-15 21:59  ProjectSettings\Physics2DSettings.asset
     文件       33796  2015-01-15 11:00  ProjectSettings\ProjectSettings.asset
     文件          53  2015-01-15 12:18  ProjectSettings\ProjectVersion.txt
     文件        4848  2014-07-15 21:59  ProjectSettings\QualitySettings.asset
     文件        4344  2014-07-15 22:18  ProjectSettings\TagManager.asset
     文件        4112  2014-07-15 21:59  ProjectSettings\TimeManager.asset

评论

共有 条评论