///////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------// //--------------------------- CHANGE SPLINE ---------------------------// //---------------------------------------------------------------------// #region Change Spline /*Quand les conditions sont remplis, change la spline que suis le Main guide du Flock * - Nouveau Path type défini * - Enregistrement de la spline actuel * - Changement du Type de comportement sur la spline * - Transfert l'information de la nouvelle spline au BezierWalker (gère les déplacements sur la spline) * - Actualise l'index du type de spline actuel */ void GetOnCircleSpline(int splineIndex) { _curPathType = PathType.Circle; curSpline = _circleSplineTab[splineIndex]; SC_bezier.travelMode = BezierSolution.TravelMode.Loop; SC_bezier.SetNewSpline(curSpline); curCircleIndex = splineIndex; }
public void StartNewBehavior(int behaviorIndex) { transform.rotation = flockInitialRot; StopAllCoroutines(); curSettingsIndex = 0; _curSpline = _splineTab[behaviorIndex]; bezierWalkerSpeed.SetNewSpline(_curSpline); StartCoroutine(SwitchSettings(_BoidSettings[behaviorIndex])); }
/// <summary> /// Initialisation du Flock /// </summary> public void InitializeFlock() { flockSettings = flockDisplay; flockInitialRot = transform.rotation; inAttack = false; _mainGuide = gameObject.transform; //Main guide prends la valeur de this (CF : Variable _mainGuide) _GuideList = new List <Transform>(); //Instanciation de la guide list _curCurveDistanceList = new List <Vector3>(); // Instanciation de la list de distance sur les courbes pour chaque guide _BoidSettings = new BoidSettings[5][]; spawnSettings = flockSettings.spawnSettings; roamSettings = flockSettings.roamSettings; attackSettings = flockSettings.attackSettings; destructionSettings = flockSettings.destructionSettings; reactionSettings = flockSettings.getAwaySettings; _BoidSettings[0] = spawnSettings; _BoidSettings[1] = roamSettings; _BoidSettings[2] = attackSettings; _BoidSettings[3] = destructionSettings; _BoidSettings[4] = reactionSettings; _KoaManager = Instantiate(_KoaPrefab, transform); //Instantiate Koa _SCKoaManager = _KoaManager.GetComponent <SC_KoaManagerDisplay>(); //Récupère le Koa manager du koa instancié _SCKoaManager.Initialize(_mainGuide, flockSettings.boidSpawn, spawnSettings[0], flockSettings); //Initialise le Koa | paramètre : Guide a suivre <> Nombre de Boids a spawn <> Comportement des boids voulu _splineTab = new BezierSolution.BezierSpline[_BoidSettings.Length]; for (int i = 0; i < flockSettings.splines.Length; i++) { if (flockSettings.splines[i] != null) { _splineTab[i] = Instantiate(flockSettings.splines[i]); } } _curSpline = splineLine; bezierWalkerSpeed.SetNewSpline(_curSpline); ActivateFlock(); isActive = true; }
void InitializeFlock() { flockInitialRot = transform.rotation; _mainGuide = gameObject.transform; _GuideList = new List <Transform>(); //Instanciation de la guide list _curCurveDistanceList = new List <Vector3>(); // Instanciation de la list de distance sur les courbes pour chaque guide _KoaManager = Instantiate(_KoaPrefab, transform); //Instantiate Koa _SCKoaManager = _KoaManager.GetComponent <SC_UI_Display_KoaManager>(); //Récupère le Koa manager du koa instancié _SCKoaManager.Initialize(_mainGuide, nbBoid, baseBoidSettings);//Initialise le Koa | paramètre : Guide a suivre <> Nombre de Boids a spawn <> Comportement des boids voulu mainAnim = _KoaManager.GetComponent <SC_UI_Display_KoaManager>()._koa.transform.GetChild(0).GetComponent <Animator>(); emissiveAnim = mainAnim.transform.GetChild(0).GetComponent <Animator>(); bezierWalkerSpeed = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); bezierWalkerSpeed.SetNewSpline(splineLine); ActivateFlock(); }