public override void StopUse() { base.StopUse(); Transform protector = controllee.transform; BezierWalkerWithSpeed walker = protector.GetComponent <BezierWalkerWithSpeed>(); walker.speed = 0; }
///////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------// //-------------------------- INITIALISATION ---------------------------// //---------------------------------------------------------------------// #region Initilisation public void InitializePathBehavior() { SC_bezier = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); //Récupère le script du flock FlockManager = GetComponent <SC_FlockManager>(); //Récupère le script du flock InitTab(); //initialise tout les tableaux //Premier comportement quand la nuée est spawn curCircleIndex = 0; newCircleIndex = 0; }
private void Awake() { nextSplineFirstPoint = nextSplineToFollow.GetPoint(0f); walkerWithSpeed = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); if (walkerWithSpeed == null) { Debug.Log("Couldn't find walker for " + name); } else { walkerWithSpeed.spline = nextSplineToFollow; } defaultParent = transform.parent; }
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(); }
public override void Use() { base.Use(); // Set control player position Rigidbody2D rb = usingPlayer.GetComponent <Player>().rb(); rb.velocity = new Vector2(0, rb.velocity.y); // Control the protector direction Transform protector = controllee.transform; BezierWalkerWithSpeed walker = protector.GetComponent <BezierWalkerWithSpeed>(); float inputVertical = (Input.GetKey(usingPlayer.GetInputKey()[(int)GameSetting.PlayerInput.Left])) ? -1 : (Input.GetKey(usingPlayer.GetInputKey()[(int)GameSetting.PlayerInput.Right])) ? 1 : 0; walker.speed = inputVertical; //// get the angle Vector3 norTar = (robot.transform.position - protector.position).normalized; float angle = Mathf.Atan2(norTar.y, norTar.x) * Mathf.Rad2Deg; //// rotate to angle Quaternion rotation = new Quaternion(); rotation.eulerAngles = new Vector3(0, 0, angle - 90); protector.rotation = rotation; }
//---------------------------------------------------------------------// //---------------------------------------------------------------------// //------------------------------- INIT --------------------------------// //---------------------------------------------------------------------// #region Init void Awake() { isActive = false; bezierWalkerSpeed = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); bezierWalkerTime = GetComponent <BezierSolution.BezierWalkerWithTime>(); }
void Start() { bezierWalker = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); }
//---------------------------------------------------------------------// //---------------------------------------------------------------------// //------------------------------- INIT --------------------------------// //---------------------------------------------------------------------// #region Init void Awake() { bezierWalkerSpeed = GetComponent <BezierSolution.BezierWalkerWithSpeed>(); bezierWalkerTime = GetComponent <BezierSolution.BezierWalkerWithTime>(); flockWeaponManager = GetComponent <SC_FlockWeaponManager>(); }