Ejemplo n.º 1
0
 private void activateBrick(List<ProceduralBrickParam> _list)
 {
     foreach (ProceduralBrickParam _parameter in _list)
     {
         _parameter.Rename();
         print (_parameter.name);
         currParam = _parameter;
         currModBrick = findBrick();
         enableBrick();
         disableBrick();
         toggleBrick();
         attributeWaypoint();
         giveDirections();
         setupTowerLength();
         swapTowerRotation();
         _parameter.isTriggered = true;
     }
     _list.Clear();
 }
Ejemplo n.º 2
0
    void CreateBrick()
    {
        currentLevelBrickGO = Instantiate(remainingLevelBricks[0]);
        currentLevelBrick   = currentLevelBrickGO.GetComponent <LevelBrick>();
        if (currentLevelBrick.SpawnFromBack)
        {
            currentLevelBrick.ReverseSpawnables();
            brickPos = new Vector3(0, 0, offsetZBack - ((currentLevelBrick.Plane.transform.localScale.z * 10) / 2));
        }
        else
        {
            brickPos = new Vector3(0, 0, offsetZFront + ((currentLevelBrick.Plane.transform.localScale.z * 10) / 2));
        }

        currentLevelBrickGO.transform.position = brickPos;

        if (remainingLevelBricks.Count == 1)
        {
            currentLevelBrick.WaitUntilBrickEnd();
        }
    }
Ejemplo n.º 3
0
 public float getSpeed(LevelBrick _brick, Dictionary<LevelBrick.typeList, float> _dico)
 {
     float res = 0f;
     if (speed == 0)
     {
         if (_dico.ContainsKey(_brick.type) == false)
         {
             Debug.LogError("Couldn't find " + type.ToString() + " speed");
             Debug.Break();
         }
         res = _dico[_brick.type];
         if (res == 0)
         {
             Debug.Log("Might be an error with" + type.ToString() + "speed");
         }
     }
     else
     {
         res = speed;
     }
     return res;
 }
Ejemplo n.º 4
0
    private void triggerList()
    {
        if (LinearSetup.ListBricks != null)
        {
            List<BrickStepParam> paramlist = LinearSetup.ListBricks.FindAll((BrickStepParam para) => para.stepID == _CURRENTSTEP.stepID);

            foreach (BrickStepParam _parameter in paramlist)
            {
                currParam = _parameter;
                currModBrick = findBrick();
                attributeWaypoint();
                giveDirections();
                enableBrick();
                disableBrick();
                setupTowerLength();
                swapTowerRotation();
            }
        }
    }
Ejemplo n.º 5
0
 private LevelBrick findBrick()
 {
     LevelBrick res = null;
     string typeToFetch = currParam.Brick.ToString();
     string idToFetch = "_" + currParam.ID.ToString();
     currModBrick = levMan.bricksMan.BricksList.Find ((LevelBrick obj) => obj.name == typeToFetch + idToFetch);
     if (currModBrick == null)
     {
         Debug.LogError("The brick " + typeToFetch + idToFetch + " hasn't been found");
         Debug.Break();
     }
     res = currModBrick;
     return res;
 }
Ejemplo n.º 6
0
    private ProceduralBrickParam addNewParam(LinearStep _stp, LevelBrick  _brick, int _randChance = 50)
    {
        // Création de l'instance
        brpm = ProceduralBrickParam.CreateInstance("ProceduralBrickParam") as ProceduralBrickParam;

        // Attribution des paramètres

        //		_stp.Enemies_SpeedMultiplier = 1f;
        //		int speedRand = Random.Range(0,10);
        //		_stp.Enemies_SpeedMultiplier = (speedRand < 5 && _stp.stepID > 3) ?  1.1f : 1f;

        brpm.Brick = _brick.type;
        brpm.chanceToTrigger = _randChance;
        if (_brick.GetComponent<PatrolBrick>() != null)
        {
            brpm.giveWPM = _brick.GetComponent<PatrolBrick>().brickPath.id;
        }
        brpm.ID = _brick.brickId;

        int enableRand = Random.Range(0,10);
        brpm.tryEnable = (enableRand <= 5) ? true : false;

        int disableRand = Random.Range(0,10);
        brpm.tryDisable = (disableRand <= 5 && brpm.tryEnable == false && restrainDisable == false) ? true : false;

        brpm.Toggle = false;
        if (brpm.tryEnable == false && brpm.tryDisable == false)
        {
            int toggleRand = Random.Range(0,10);
            brpm.Toggle = (toggleRand <= 5 && restrainToggle == false) ? true : false;
        }

        brpm.addLength = Random.Range(3, 10);

        int changeDirRand = Random.Range(0, 10);
        string randDir = "";
        randDir += (changeDirRand <= 5) ?"U" : "";
        randDir += (changeDirRand <= 5) ?""  : "D";
        randDir += (changeDirRand <= 5) ?""  : "L";
        randDir += (changeDirRand <= 5) ?"R" : "";
        brpm.changeDirections = randDir;

        int invertRand = Random.Range(0,10);
        brpm.tryInvert = (invertRand <= 2 && _stp.stepID > 3 && restrainInvert == false) ? true : false;

        brpm.name = brpm.stepID + "|" + brpm.Brick + brpm.ID + brpm.giveWPM + brpm.changeDirections + brpm.addLength + brpm.tryInvert;

        // Ajout dans les listes
        _stp.LinkedParam.Add(brpm);
        setup.ListProcParam.Add(brpm);
        AssetDatabase.CreateAsset(brpm , "Assets/Resources/Maps/" + setup.lvlParam.NAME + "/ProcParam/" + Random.Range(0,1000000).ToString() +".asset");
        EditorUtility.SetDirty(brpm);
        return brpm;
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     linkedObject = gameObject.transform.parent.gameObject.GetComponent<LevelBrick>();
 }
Ejemplo n.º 8
0
 void OnTriggerEnter(Collider _oth)
 {
     if (_oth.GetComponent<LevelBrick>() != null && _oth.GetComponent<LevelBrick>().brickDef == LevelBrick.brickType.Floor)
     {
         currFloor = _oth.GetComponent<LevelBrick>();
         currFloor.objOnFloor.Add(this.gameObject);
     }
 }
Ejemplo n.º 9
0
 // Use this for initialization
 public void Setup(LevelBrick _par)
 {
     _parent = _par;
 }
Ejemplo n.º 10
0
 private ProceduralBrickParam findRandomParam(List<ProceduralBrickParam> _list)
 {
     if (_list.Count == 0)
     {
         return null;
     }
     int rand = Random.Range(0, _list.Count);
     currParam = _list[rand];
     currModBrick = findBrick();
     return currParam;
 }