public void CollectBy(PersoController collector) { switch (type) { case LumType.Red: collector.Heal(20); break; case LumType.Yellow: GetPerso <World>().lums++; break; case LumType.Blue: collector.SFX("Rayman2/Lums/Yellow").Play(0.1f, 0.3f); collector.Heal(20); break; case LumType.Green: if (collector.checkpoint != null) { collector.checkpoint.lum.Restart(); } collector.checkpoint = creator as CHR_CheckP; break; } SpawnParticle(collector, "LumCollect", type); SetNullPos(); collector.SFX($"Rayman2/Lums/{type}").Play(0.1f); OnCollect(collector); }
void FindHoming(Vector3 newDir) { float close = 15; PersoController closest = null; foreach (var p in FindObjectsOfType <PersoController>()) { float dist = rayman.DistTo(p.pos); if (!p.isMainActor //&& p.perso.perso.stdGame.ConsideredOnScreen() && p.HasCollisionType(OpenSpace.Collide.CollideType.ZDE) && (dist < close)) { close = dist; closest = p; } } if (closest != null) { vel = (closest.pos - pos).normalized * vel.magnitude; } Bounce3D(newDir); pos += vel.normalized * radius / 2; t_bounce.Start(0.03f); }
void Start() { list = GetComponentInParent <PersoList>(); perso = perso.GetComponent <PersoController>(); persoName.text = perso.perso.perso.namePerso; }
public void RayThrowCarriedForward() { PersoController targ = null; if (carryPerso is BNT_TonneauFusee) { targ = FindTarget(30); } else if (carryPerso is SUN_magic_key k) { var t = FindTarget <SUN_magie_simple>(30); if (t != null && t.color == k.color) { targ = t; } } else if (carryPerso is BNT_ThePrune) { targ = FindTarget <pirate_gorille>(30); } anim.Set(Anim.CarryThrow, anim.currPriority, 45); Timers("Throw").Start(0.4f, () => ThrowCarriedFoward(targ)); SetRule("Ground"); DisableForSeconds(0.7f); }
public void Load() { foreach (var f in Main.persoScripts) { if (f.BaseType == typeof(PersoController) && PersoController.GetPerso(f) != null) { ResManager.Inst <PersoListFamily>("MapEditor/UI/PersoListFamily", famList).familyType = f; } } }
private void Awake() { if (PREFAB_Ennemy.GetComponent <EnnemyController>() == null) { Debug.LogError("EnnemySpawner is spawning an object without an EnnemyController."); gameObject.SetActive(false); } m_playerController = FindObjectOfType <PersoController>(); m_GH = FindObjectOfType <GameHandler>(); m_pathf = FindObjectOfType <Pathfinder>(); }
public void CollectBy(PersoController collector) { switch (type) { case LumType.Red: collector.Heal(20); break; case LumType.Green: if (collector.checkpoint != null) { collector.checkpoint.lum.Restart(); } collector.checkpoint = (CHR_CheckP)creator; break; } OnCollect(collector); }
private void Update() { if (!Main.loaded) { return; } foreach (var n in persoNames) { var p = PersoController.GetPerso(n); if (p != null) { p.graph = this; } } }
public void InvokeOn(PersoController perso) { var pars = new List <object>(); foreach (var p in methodParams) { if (p.type == ValueInput.Type.Const) { pars.Add(p.constVal); } else { pars.Add(p.InvokeAndGetOn(perso)); } } }
public override void OnCollect(PersoController collector) { collector.Heal(20); if (t_poof.active) { return; } float time = GetDsgVar <float>("Float_0"); time = 6.5f; t_poof.Start(time, () => { foreach (var l in all) { l.Remove(); } }, false); }
void Rule_Swinging(PersoController grap, float dist) { if (newRule) { helic = false; sDist = DistTo(grap); gravity = -30; sY = VecAngleY(grap.pos); sX = VecAngleX(grap.pos); sVel = -100 + velY * 6 + velXZ.magnitude * 5 /* - (sDist - dist) * sDist * 0.2f*/; velY = 0; } if (apprVel.magnitude > hiSpd) { hiSpd = apprVel.magnitude; } float sin = Mathf.Sin(sX * Mathf.Deg2Rad); sVec = (grap.pos - pos).normalized; sVel += sin * dt * 100 * gravity / DistTo(grap); sX += sVel * dt; sY += lStick_s.x * dt * 60; prevDir = dir; dir = Mathf.Sign(sVel); if (dir != prevDir && Mathf.Abs(sX) < 90) { Timers("SwingBoost").Start(0.55f, () => sVel += dir * dt * 100, null); } if (Mathf.Abs(sVel) > 250) { sVel /= 1f + 1 * dt; } rot.eulerAngles = new Vector3(-sX, sY + 180, 0); Orbit(grap.pos, sDist = Mathf.Lerp(sDist, dist - 1, dt * 2), sY, sX - 90, 8, 8); anim.Set(sVel < 0 ? Anim.SwingFwd : Anim.SwingBack); }
public void RayCarryPerso(PersoController p, bool caughtInAir) { if (caughtInAir) { if (p != null) { CarryPerso(p, 14); } anim.Set(Anim.CarryCatch); DisableForSeconds(0.3f); } else { if (p != null) { Timers("Pickup").Start(0.25f, () => CarryPerso(p, 14)); } anim.Set(Anim.CarryPickUp); DisableForSeconds(0.5f); } }
//SetupScene initializes our level and calls the previous functions to lay out the game board public void SetupScene(int a_level) { Camera m_Camera = FindObjectOfType <Camera>(); //Creates the outer walls and floor. BoardSetup(); //Reset our list of gridpositions. InitialiseList(); //Instantiate a random number of wall tiles based on minimum and maximum, at randomized positions. LayoutObjectAtRandom(wallTiles, wallCount.minimum, wallCount.maximum); //Instantiate a random number of food tiles based on minimum and maximum, at randomized positions. LayoutObjectAtRandom(weaponTiles, weaponCount.minimum, weaponCount.maximum); //Determine number of enemies based on current level number, based on a logarithmic progression //int t_spawnerCount = (int)Mathf.Log(a_level, 6f); //Instantiate a random number of enemies based on minimum and maximum, at randomized positions. LayoutObjectAtRandom(spawnerTiles, spawnerCount.minimum, spawnerCount.maximum); //Instantiate the exit tile in the upper right hand corner of our game board t_perso = Instantiate(exit, new Vector3(m_MinColumns + 1, m_MinRows + 1, 0f), Quaternion.identity); t_perso.GetComponent <PersoController>().Cam = m_Camera; m_Camera.GetComponent <FollowTargetRandom>().Target = t_perso.transform; PersoController t_PersoController = t_perso.GetComponent <PersoController>(); t_PersoController.ScoreText = FindObjectOfType <Canvas>().transform.GetChild(1).GetComponent <TextMeshProUGUI>(); t_PersoController.VieText = FindObjectOfType <Canvas>().transform.GetChild(2).GetComponent <TextMeshProUGUI>(); grille.AppellerTuiles(boardHolder.transform); t_PersoController.PlayerLastTuile = grille.GetTuile(grille.WorldToGrid(t_perso.transform.position)); t_PersoController.EndPanel = FindObjectOfType <Canvas>().transform.GetChild(5).gameObject; t_perso.GetComponent <PersoInteract>().Interact = FindObjectOfType <Canvas>().transform.GetChild(3).transform.GetChild(0).gameObject; t_perso.GetComponent <Shooting>().MunitionsText = FindObjectOfType <Canvas>().transform.GetChild(4).GetComponent <TextMeshProUGUI>(); }
protected override void OnStart() { interrupteur = GetDsgVar <PersoController>("Perso_0"); SetRule("Default"); }
void Rule_Swinging(PersoController grap, float dist) { if (newRule) { anim.Set(pos.y > grap.pos.y - dist ? Anim.SwingFwd : Anim.SwingFwdLoop); flipDone = false; helic = false; sDist = DistTo(grap) + 2; gravity = -30; sY = VecAngleY(grap.pos); sX = VecAngleX(grap.pos); sVel = -150 + velXZ.magnitude * 50 / sDist; velY = 0; Timers("Ground Detect Wait").Start(0.5f); } // Dumb fix for newRule not being on the first frame if (velY != 0) { return; } if (Timers("Ground Detect Wait").finished&& col.ground.AnyGround) { SetRule("Ground"); return; } if (apprVel.magnitude > hiSpd) { hiSpd = apprVel.magnitude; } float sin = Mathf.Sin(sX * Mathf.Deg2Rad); sVec = (grap.pos - pos).normalized; sVel += sin * dt * 350 * gravity / Mathf.Pow(DistTo(grap), 1.5f); sX += sVel * dt * 3 / Mathf.Sqrt(DistTo(grap)); sY += lStick_s.x * dt * 60; prevDir = dir; dir = Mathf.Sign(sVel); if (!flipDone && sX < 10 && sX > -10) { flipDone = true; SFX("Rayman2/Swing" + (dir == -1 ? "Fwd" : "Back")).Play(); Timers("Flip").Start(DistTo(grap) / 25, () => { anim.Set(sVel > 0 ? Anim.SwingFwd : Anim.SwingBack); }); } // While above grap if (Mathf.Abs(sX) > 100) { sVel /= 1f + 1 * dt; } // While below grap else { flipDone = false; if (dir != prevDir) { Timers("SwingBoost").Start(0.55f, () => sVel += dir * dt * 10000 / (dist * dist), null); } } if (Mathf.Abs(sVel) > 250) { sVel /= 1f + 1 * dt; } Orbit(grap.pos, sDist = Mathf.Lerp(sDist, dist - 1, dt * 2), sY, sX - 90, 8, 8); rot = new Vector3(sX, sY, 0); // Beam if (beam == null) { beam = SpawnParticle("Grappin"); } var hand = GetChannel(2, true); beam.transform.position = hand.pos; beam.transform.LookAt(grap.transform); var main = beam.main; var main2 = beam.transform.GetChild(0).GetComponent <ParticleSystem>().main; float length = Dist(hand, grap) / 100; main.startLifetimeMultiplier = length; main2.startLifetimeMultiplier = length; }
private void Awake() { m_persoController = FindObjectOfType <PersoController>(); }
protected override void OnStart() { inverseur = GetDsgVar <PersoController>("Perso_1"); inverseurSwitch = ((OLP_Inverseur)inverseur).interrupteur; SetRule("Default"); }
public virtual void OnCollect(PersoController collector) { }