/* * Control Points * 0 == StartPosition * 3 == CurrentPosition */ public ObstacleParticleCarrionSwarm(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_DeathProphet_CarrionSwarm); Radius = ability?.GetRadius(ability.Name) ?? 300; var special = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "start_radius"); if (special != null) { _startRadius = special.Value; } var special1 = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "range"); var special2 = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "speed"); if (special1 != null && special2 != null) { _range = special1.Value + Radius + _startRadius; _speed = special2.Value; _delay = _range / _speed; } ID = pathfinding.AddObstacle(Position, EndPosition, Radius); Debugging.WriteLine("Adding CarionSwarm particle: {0} - {1}", Radius, _delay); }
public static Vector3 ExtendUntilWall( Vector3 start, Vector3 direction, float distance, NavMeshPathfinding pathFinder) { var step = pathFinder.CellSize / 2f; var testPoint = start; var sign = distance > 0f ? 1f : -1f; distance = Math.Abs(distance); while (pathFinder.GetCellFlags(testPoint).HasFlag(NavMeshCellFlags.Walkable) && distance > 0f) { if (step > distance) { step = distance; } testPoint = testPoint + sign * direction * step; distance -= step; } return(testPoint); }
/// <summary> /// The get valid move position. /// </summary> /// <param name="currentTarget"> /// The current target. /// </param> /// <param name="unit"> /// The unit. /// </param> /// <param name="pathfinding"> /// The pathfinding. /// </param> /// <returns> /// The <see cref="Vector3" />. /// </returns> public static Vector3 GetValidMovePosition( Vector3 currentTarget, IAbilityUnit unit, NavMeshPathfinding pathfinding) { var dir = currentTarget - unit.SourceUnit.Position; dir.Normalize(); // try to walk further if position is not valid foreach (var possibleTarget in GetPositionsWithDistanceAndAngle(currentTarget, dir, pathfinding.CellSize, 4) ) { var flags = pathfinding.GetCellFlags(possibleTarget); if (IsWalkableCell(flags)) { return(possibleTarget); } } // var perpendicular = dir.Perpendicular(); // perpendicular.Normalize(); // var newTarget = unit.SourceUnit.Position + (perpendicular * 50); // foreach (var possibleTarget in GetPositionsWithDistanceAndAngle(newTarget, perpendicular, pathfinding.CellSize, 4)) // { // var flags = pathfinding.GetCellFlags(possibleTarget); // if (IsWalkableCell(flags)) // { // return possibleTarget; // } // } // newTarget = unit.SourceUnit.Position + (perpendicular * -50); // foreach (var possibleTarget in GetPositionsWithDistanceAndAngle(newTarget, perpendicular, pathfinding.CellSize, 4)) // { // var flags = pathfinding.GetCellFlags(possibleTarget); // if (IsWalkableCell(flags)) // { // return possibleTarget; // } // } var newTarget = unit.SourceUnit.Position + dir * -50; // no valid position found for our old movement target, so try to find a new one foreach (var possibleTarget in GetPositionsWithDistanceAndAngle(newTarget, dir, pathfinding.CellSize, 4)) { var flags = pathfinding.GetCellFlags(possibleTarget); if (IsWalkableCell(flags)) { return(possibleTarget); } } // well no luck? return(newTarget); }
public ObstacleParticleEarthSpike(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Lion_Impale); Radius = ability?.GetRadius(ability.Name) ?? 125; Debugging.WriteLine("Adding EarthSpike particle: {0}", Radius); }
public ObstacleParticleIceBlast(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_AncientApparition_IceBlast); Radius = ability?.GetRadius(ability.Name) ?? 600; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding IceBlast particle: {0}", Radius); }
public ObstacleParticlePowershot(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Windrunner_Powershot); Radius = ability?.GetRadius(ability.Name) ?? 125; ID = pathfinding.AddObstacle(Position, EndPosition, Radius); Debugging.WriteLine("Adding Powershot particle: {0}", Radius); }
public ObstacleParticleFireSpirit(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Phoenix_LaunchFireSpirit); Radius = ability?.GetRadius(ability.Name) ?? 175; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding FireSpirit particle: {0}", Radius); }
/* * 0 == position * 1 == radius * 3 == some other position nearby */ public ObstacleParticleChakram(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Shredder_Chakram); Radius = ability?.GetRadius(ability.Name) ?? 675; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding Chakram particle: {0}", Radius); }
/* * 0 == position */ public ObstacleParticleEchoStomp(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.Name == "elder_titan_echo_stomp"); Radius = ability?.GetRadius(ability.Name) ?? 500; _delay = 1.6f; _delay = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "cast_time")?.Value ?? 1.6f; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding EchoStomp particle: {0}", Radius); }
/* * 0 == position */ public ObstacleParticleBloodRitual(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Bloodseeker_Bloodbath); Radius = ability?.GetRadius(ability.Name) ?? 600; _delay = 2.6f; _delay = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "delay")?.Value ?? 2.6f; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding BloodRitual particle: {0}", Radius); }
public ObstacleParticleEMP(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Invoker_EMP); Radius = ability?.GetRadius(ability.Name) ?? 675; _delay = 2.9f; _delay = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "delay")?.Value ?? 2.9f; ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding EMP particle: {0} {1}", Radius, _delay); }
/* * Control Points * 0 == StartPosition * 1 == EndPosition * 2 == Speed in X */ public ObstacleParticleTimberChain(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Shredder_TimberChain); Radius = ability?.GetRadius(ability.Name) + 8 ?? 98; if (ability != null && ability.Level > 0) { _range = ability.GetRange(ability.Level - 1) + Radius; } ID = pathfinding.AddObstacle(Position, EndPosition, Radius); Debugging.WriteLine("Adding TimberChain particle: {0} - {1}", Radius, _range); }
public void Activate() { this.owner = EntityManager9.Owner; this.context.Renderer.TextureManager.LoadFromDota( "o9k.waypoint_white", @"panorama\images\hud\reborn\ping_icon_waypoint_psd.vtex_c", new TextureProperties { ColorRatio = new Vector4(1f, 1f, 1f, 1f) }); this.pathfinder = new NavMeshPathfinding(); this.updateHandler = UpdateManager.Subscribe(this.OnUpdate, 300, false); this.key.ValueChange += this.KeyOnValueChange; }
virtual protected void Awake() { //cache component references rb = gameObject.GetComponent <Rigidbody2D>(); currentHealth = settings.maxHealth; //cache navigation hurtVFX = gameObject.GetComponentInChildren <MultiSpriteHurtFlash>(); navComp = gameObject.GetComponentInChildren <NavMeshPathfinding>(); aSource = GetComponent <AudioSource>(); //initial values currHurtTime = settings.hurtTime; currTimeBeforeInvulnerable = settings.timeBeforeInvulnerable; BindToInitManager(); float invokeStartTime = UnityEngine.Random.Range(0.0f, 0.5f); InvokeRepeating("ProcessAI", invokeStartTime, settings.aiTickrate); }
/* * 0 == StartPosition * 1 == EndPosition * 3 == CurrenPosition */ public ObstacleParticleCallDown(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect, bool first) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Gyrocopter_Call_Down); Radius = ability?.GetRadius(ability.Name) ?? 600; if (first) { _delay = 2.0f; _delay = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "slow_duration_first")?.Value ?? 2.0f; } else { _delay = 4.0f; _delay = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "slow_duration_second")?.Value ?? 4.0f; } ID = pathfinding.AddObstacle(Position, Radius); Debugging.WriteLine("Adding CallDown particle: {0}", Radius); }
/* * Control Points * 0 == StartPosition * 1 == EndPosition */ public ObstacleParticleHook(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Pudge_MeatHook); Radius = ability?.GetRadius(ability.Name) + 8 ?? 108; if (ability != null && ability.Level > 0) { _range = ability.GetRange(ability.Level - 1) + Radius; } var special = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "hook_speed"); if (special != null) { _speed = special.Value; } ID = pathfinding.AddObstacle(Position, EndPosition, Radius); Debugging.WriteLine("Adding Hook particle: {0} - {1}", Radius, _range); }
/* * Control Points * 0 == StartPosition * 1 == EndPosition */ public ObstacleParticleEarthSplitter(NavMeshPathfinding pathfinding, Entity owner, ParticleEffect particleEffect) : base(0, owner, particleEffect) { var ability = ObjectManager.GetEntities <Ability>() .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Ability_Elder_Titan_EarthSplitter); Radius = ability?.GetRadius(ability.Name) ?? 300; if (ability != null && ability.Level > 0) { _range = ability.GetRange(ability.Level - 1) + Radius; } var special = ability?.AbilitySpecialData.FirstOrDefault(x => x.Name == "speed"); if (special != null) { _speed = special.Value; } _delay = _range / _speed; ID = pathfinding.AddObstacle(Position, EndPosition, Radius); Debugging.WriteLine("Adding EarthSplitter particle: {0} - {1}", Radius, _range); }
public Pathfinder() { Pathfinding = new NavMeshPathfinding(); Game.OnUpdate += OnUpdate; }