Пример #1
0
    public static void CreateNPCGroup(SceneMap map, int delayTime)
    {
        int groupId = AutoIncrementGenerator.Get(map.GetComponentsInChildren <SceneNPCGroup>());
        var go      = new GameObject("组-" + groupId);
        var group   = go.AddComponent <SceneNPCGroup>();

        group.groupId   = groupId;
        group.delayTime = delayTime;

        go.transform.SetParent(map.transform);
        go.transform.position   = selectionPosition;
        go.transform.localScale = Vector3.one;
        go.transform.rotation   = Quaternion.identity;

        Selection.activeGameObject = go;

        _isUpdated = true;
    }
Пример #2
0
    public static SceneNPC CreateNPC(SceneMap map, SceneObjectBuilder builder)
    {
        var npcId = AutoIncrementGenerator.Get(MapManager.current.npcList);
        //var go = new GameObject ("NPC-"+npcId);
        var go = GameObject.CreatePrimitive(PrimitiveType.Capsule);

        go.name = "NPC-" + npcId;
        var obj = go.AddComponent <SceneNPC>();

        obj.objectId    = npcId;
        obj.resId       = builder.res;
        obj.objectType  = builder.type;
        obj.objectShape = builder.shape;
        obj.objectSize  = builder.size;

        //var offset = CaculatePostionOffset (builder);
        //CreateCollider (go, builder);

        var offset = new Vector3(0, obj.objectSize.y, 0);

        var parent = map.transform;

        if (MapManager.selectionWave != null)
        {
            parent = MapManager.selectionWave.transform;
        }
        else if (MapManager.selectionGroup != null)
        {
            parent = MapManager.selectionGroup.transform;
        }

        go.transform.SetParent(parent);
        go.transform.position   = selectionPosition + offset;
        go.transform.localScale = Vector3.one;
        go.transform.rotation   = Quaternion.identity;

        map.AddNPC(obj);

        _isUpdated = true;

        Selection.activeGameObject = go;

        return(obj);
    }
Пример #3
0
    public static FlyingPath CreateFlyingPath(SceneMap map)
    {
        var pathID = AutoIncrementGenerator.Get(MapManager.current.flyingPathList);
        //var go = new GameObject ("NPC-"+npcId);
        var go  = new GameObject("FlyingPath-" + pathID);
        var obj = go.AddComponent <FlyingPath>();

        obj.objectId = pathID;


        go.transform.SetParent(map.transform);
        go.transform.position   = selectionPosition;
        go.transform.localScale = Vector3.one;
        go.transform.rotation   = Quaternion.identity;

        map.AddFlyingPoint(obj);

        Selection.activeGameObject = go;

        return(obj);
    }
Пример #4
0
    public static void CreateTransmitNode(SceneMap map, int mapId, int nodeId, Vector3 nodeSize)
    {
        int transmitId = AutoIncrementGenerator.Get(map.transmitList);

        CreateTransmitNode(map, transmitId, mapId, nodeId, nodeSize);
    }