コード例 #1
0
    public override void Build(AutoSkillParticleEmitterItem targetObj)
    {
        ///SECTOR
        if (targetObj.emitterShapeType == Example.SkillShapeNew.ShapeType.SECTOR)
        {
            SectorSkillShape Sector     = (SectorSkillShape)targetObj.emitterShape;
            Vector3          dir        = Target.forward;
            float            angle      = Sector.angle / (targetObj.emitterCount - 1);
            float            beginAngle = -angle * (targetObj.emitterCount - 1) / 2;

            for (int j = 0; j < targetObj.waves; j++)
            {
                for (int i = 0; i < targetObj.emitterCount; i++)
                {
                    Vector3    ndir = RotateRound(dir, new Vector3(0, 1, 0), beginAngle + i * angle);
                    GameObject sub  = new GameObject();
                    sub.name = "SubParticle_" + j + "_" + i;
                    sub.transform.SetParent(targetObj.transform);
                    SkillParticleActionItem sg = sub.AddComponent <SkillParticleActionItem>();
                    sg.export = true;
                    sg.effect = targetObj.effectPrefab;
                    //sg.effectName = targetObj.effectPrefab.name;
                    sg.pathType     = targetObj.particlePathType;
                    sg.Firetime     = targetObj.particleStartFrame / 1000f + targetObj.waveDelay * j / 1000f;
                    sg.Duration     = targetObj.particleDuration / 1000f;
                    sg.hitshapeType = targetObj.particleHitShapeType;
                    //sg.hitShape = targetObj.hitShape;
                    AddShape(sg, targetObj.hitShape);
                    if (targetObj.particlePathType == Example.SkillPath.PathType.LINE)
                    {
                        sg.path          = sub.AddComponent <LineSkillPath>();
                        sg.path.pathType = Example.SkillPath.PathType.LINE;
                        LineSkillPath line = (LineSkillPath)sg.path;
                        line.startPos = GameObject.CreatePrimitive(PrimitiveType.Cube).transform;
                        line.startPos.gameObject.name = "LineStart";
                        line.startPos.parent          = sg.transform;
                        line.startPos.position        = Target.position + targetObj.emitterOffset;
                        line.startPos.localScale      = Vector3.one * 0.3f;

                        line.endPos                 = GameObject.CreatePrimitive(PrimitiveType.Cube).transform;
                        line.endPos.parent          = sg.transform;
                        line.endPos.gameObject.name = "LineEnd";
                        line.endPos.position        = Target.position + targetObj.emitterOffset + ndir * Sector.radius;
                        line.endPos.localScale      = Vector3.one * 0.3f;
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: SkillShape.cs プロジェクト: qipa/SkillEditor
    public void AddShape(SkillParticleActionItem sg, SkillShape shape)
    {
        GameObject targetObj = sg.gameObject;

        if (shape.shapeType == Example.SkillShapeNew.ShapeType.CIRCLE)
        {
            CircleSkillShape cskill = (CircleSkillShape)shape;
            CircleSkillShape shape0 = targetObj.AddComponent <CircleSkillShape>();
            shape0.Target = targetObj.transform;
            shape0.offset = cskill.offset;
            shape0.radius = cskill.radius;
            sg.hitShape   = shape0;
        }

        if (shape.shapeType == Example.SkillShapeNew.ShapeType.BOX)
        {
            BoxSkillShape cskill = (BoxSkillShape)shape;
            BoxSkillShape shape0 = targetObj.AddComponent <BoxSkillShape>();
            shape0.Target = targetObj.transform;
            shape0.offset = cskill.offset;
            shape0.width  = cskill.width;
            shape0.height = cskill.height;
            sg.hitShape   = shape0;
        }

        if (shape.shapeType == Example.SkillShapeNew.ShapeType.SECTOR)
        {
            SectorSkillShape cskill = (SectorSkillShape)shape;
            SectorSkillShape shape0 = targetObj.AddComponent <SectorSkillShape>();
            shape0.Target = targetObj.transform;
            shape0.offset = cskill.offset;
            shape0.angle  = cskill.angle;
            shape0.radius = cskill.radius;
            sg.hitShape   = shape0;
        }
        if (shape.shapeType == Example.SkillShapeNew.ShapeType.TRIANGLE)
        {
            TriangleSkillShape cskill = (TriangleSkillShape)shape;
            TriangleSkillShape shape0 = targetObj.AddComponent <TriangleSkillShape>();
            shape0.Target = targetObj.transform;
            shape0.offset = cskill.offset;
            shape0.width  = cskill.width;
            shape0.height = cskill.height;
            sg.hitShape   = shape0;
        }
    }
コード例 #3
0
 SkillShape ReplaceShape(Example.SkillShapeNew.ShapeType oldShape, Example.SkillShapeNew.ShapeType newShape, GameObject targetObj, SkillShape shape, Transform actor, Vector3 offset)
 {
     if (oldShape != newShape)
     {
         if (shape != null)
         {
             DestroyImmediate(shape);
         }
         if (newShape == Example.SkillShapeNew.ShapeType.CIRCLE)
         {
             CircleSkillShape shape0 = targetObj.AddComponent <CircleSkillShape>();
             shape0.Target = actor;
             shape0.offset = offset;
             return(shape0);
         }
         if (newShape == Example.SkillShapeNew.ShapeType.BOX)
         {
             BoxSkillShape shape0 = targetObj.AddComponent <BoxSkillShape>();
             shape0.Target = actor;
             shape0.offset = offset;
             return(shape0);
         }
         if (newShape == Example.SkillShapeNew.ShapeType.SECTOR)
         {
             SectorSkillShape shape0 = targetObj.AddComponent <SectorSkillShape>();
             shape0.Target = actor;
             shape0.offset = offset;
             return(shape0);
         }
         if (newShape == Example.SkillShapeNew.ShapeType.TRIANGLE)
         {
             TriangleSkillShape shape0 = targetObj.AddComponent <TriangleSkillShape>();
             shape0.Target = actor;
             shape0.offset = offset;
             return(shape0);
         }
         if (newShape == Example.SkillShapeNew.ShapeType.NONE)
         {
             return(null);
         }
     }
     return(shape);
 }