示例#1
0
    protected override void addTile(int x, int y, int id)
    {
        //SPECIAL CHEAP
        if (id == 6)
        {
            chunk.startingChunk      = true;
            chunk.checkPointLocation = new Vector2(x, y);
        }



        if (id > linker.prefabs.Count)
        {
            Debug.LogError("Il manque des prefab dans le linker." + " : je ne connais pas id " + id + ". Quesque tu as fais OLI!");
        }
        else if (id != 0)
        {
            GameObject prefab = linker.prefabs[id];
            if (prefab == null)
            {
                Debug.LogWarning("Erreur au block " + x + "," + y + " : je ne connais pas id " + id + ". Quesque ta faite Õli!!");
            }
            else
            {
                Vector3 position = new Vector3(x, y, 0);
                GameObjectExtend.createClone(prefab, prefab.name, tilesParent, position);
            }
        }
    }
示例#2
0
    void loadNextMap()
    {
        currentMapIndex++;
        currentMap = GameObjectExtend.createClone(maps[currentMapIndex]);
        GameObject startLocation = currentMap.FindChildRecursive("StartLocation");

        Layer.playerGo.transform.position = startLocation.transform.position;
    }
示例#3
0
        void nameRotation(GameObject prefabToRotate, string fileFolder, string nameSuffix, Vector3 vector3)
        {
            GameObject clone = GameObjectExtend.createClone(prefabToRotate);

            clone.transform.localRotation = Quaternion.Euler(vector3);
            clone.name += nameSuffix;

            PrefabUtility.CreatePrefab(fileFolder + "/" + clone.name + ".prefab", clone);
            Object.DestroyImmediate(clone);
        }
示例#4
0
    void removeBulb()
    {
        hasBulb = false;
        var lights = GetComponentsInChildren <Light>();

        foreach (var lightComponent in lights)
        {
            lightComponent.enabled = false;
        }
        GameObjectExtend.createClone(lightBulbPrefab, null, transform.position);
    }
    public override void OnEnter()
    {
        GameObject newParticule     = GameObjectExtend.createClone(Layer.gravityChangerParticule);
        GravityChangerParticule gcp = newParticule.GetComponent <GravityChangerParticule>();

        newParticule.transform.position = transform.position;

        newParticule.GetComponent <Rigidbody2D>().SetVelocity(Layer.initialVelocity);

        gcp.gravity = Layer.particuleGravity;
        SwitchState <IngredientGravitychangerReload>();

        DiableManager.instance.addDiable(gcp);
    }
示例#6
0
        void makeCloneFor(string name, Sprite sprite)
        {
            GameObject     tileCenter = GameObjectExtend.createClone(currentAutotile.basePrefab);
            SpriteRenderer sr         = tileCenter.GetComponentInChildren <SpriteRenderer>();

            if (sr != null)
            {
                sr.sprite = sprite;
            }
            string path = "Assets" + currentAutotile.outputAssetFolder + "/" + currentAutotile.name + "_" + name + ".prefab";

            PrefabUtility.CreatePrefab(path, tileCenter);
            tileCenter.Remove();
        }
示例#7
0
    void setUpPlayers()
    {
        if (player1prefab == null)
        {
            Debug.LogError("Il n'y a pas de prefab pour le player 1 !!!");
        }
        else
        {
            player1 = GameObjectExtend.createClone(player1prefab);
        }

        if (player2prefab != null)
        {
            player2 = GameObjectExtend.createClone(player2prefab);
        }
    }
示例#8
0
    void loadLevel(GameObject level)
    {
        SwitchState <GameManagerInGame>();
        if (levelGO != null)
        {
            Object.Destroy(levelGO);
        }

        levelGO = GameObjectExtend.createClone(level);
        mapData = levelGO.GetComponent <MapData>();

        relocatePlayersToStart();
        centerCamera();

        if (background != null)
        {
            background.transform.position   = new Vector3(mapData.width / 2 - 0.5f, mapData.height / 2 - 0.5f, 3);
            background.transform.localScale = new Vector3(mapData.width, mapData.height, 1);
        }
    }
示例#9
0
    GameObject getMeOrCreate(string prefabName, string prefabPath)
    {
        GameObject foundGO = GameObject.Find(prefabName);

        if (foundGO == null)
        {
            GameObject prefab = Resources.Load <GameObject>(prefabPath);
            if (prefab == null)
            {
                Debug.LogWarning("Developpeur noob, il manque le prefab de " + prefabName);
            }
            else
            {
                return(GameObjectExtend.createClone(prefab));
            }
        }
        else
        {
            return(foundGO);
        }
        return(null);
    }