public VisualEngine(Framework.FlatArray<GameCell> map, int range, FOVMethod method, RangeLimitShape shape) { this.fieldOfView = new FieldOfView<GameCell>(map); this.range = range; this.method = method; this.shape = shape; this.map = map; this.itemCharacters = new char[Enum.GetNames(typeof(BaseType)).Length]; this.itemCharacters[(int)BaseType.Armor] = '['; this.itemCharacters[(int)BaseType.Weapon] = ')'; this.itemCharacters[(int)BaseType.Consumable] = '%'; this.itemCharacters[(int)BaseType.Container] = '&'; this.itemCharacters[(int)BaseType.Gem] = '\u263c'; this.itemCharacters[(int)BaseType.Key] = '\u2552'; this.itemCharacters[(int)BaseType.Money] = '$'; this.itemCharacters[(int)BaseType.Reagent] = '\u220f'; this.itemCharacters[(int)BaseType.Recipe] = '\u222b'; this.itemCharacters[(int)BaseType.Projectile] = '('; this.itemCharacters[(int)BaseType.QuestPlot] = '\u2021'; this.itemCharacters[(int)BaseType.Quiver] = '\u00b6'; this.itemCharacters[(int)BaseType.TradeGoods] = '\u2211'; this.itemCharacters[(int)BaseType.Miscellaneous] = '}'; this.itemCharacters[(int)BaseType.Jewellery] = '\u00a7'; }
public override void Enter() { base.Enter(); _rnd = new Random(); _anim = _go.GetComponent <Animator>(); _enemyAction = _go.GetComponent <EnemyAction>(); _fieldOfView = _go.GetComponent <FieldOfView>(); }
private static void AnglePreview(FieldOfView _fow, float _viewAngle) { Vector3 viewAngleA = _fow.DirFromAngle(-_viewAngle / 2, false); Vector3 viewAngleB = _fow.DirFromAngle(_viewAngle / 2, false); Handles.DrawLine(_fow.transform.position, _fow.transform.position + viewAngleA * _fow.viewRadius); Handles.DrawLine(_fow.transform.position, _fow.transform.position + viewAngleB * _fow.viewRadius); }
public Behavior(int resetAt = 15) { dungeonMap = MainScreen.GameController.CurrentMap; player = MainScreen.GameController.Player; monsterFov = new FieldOfView(dungeonMap); resetTime = resetAt; path = null; }
// Use this for initialization void Start() { View = GetComponent <FieldOfView>(); Movement = GetComponent <NpcMovement>(); SetState("goodVibe"); StartCoroutine("RefreshEnemyState", .5f); }
public IReadOnlyCollection <ICell> ComputeFov(int xOrigin, int yOrigin, int radius, bool lightWalls) { var rogueSharpMap = map.ToRogueSharpMap(); Fov = new FieldOfView(rogueSharpMap); return(Fov.ComputeFov(xOrigin, yOrigin, radius, lightWalls).Select(c => map.GetCellAt(new Core.Point(xOrigin, yOrigin))).ToList()); }
private bool IsTransformInFOV(Transform transform, FieldOfView fieldOfView) { if (fieldOfView.visibleTargets.Contains(transform)) { return(true); } return(false); }
public bool Act(Monster monster, CommandSystem commandSystem, Game game) { DungeonMap dungeonMap = game.World; Player player = game.Player; FieldOfView monsterFov = new FieldOfView(dungeonMap); // If the monster has not been alerted, compute a field-of-view // Use the monster's Awareness value for the distance in the FoV check // If the player is in the monster's FoV then alert it // Add a message to the MessageLog regarding this alerted status if (!monster.TurnsAlerted.HasValue) { monsterFov.ComputeFov(monster.X, monster.Y, monster.Awareness, true); if (monsterFov.IsInFov(player.X, player.Y)) { game.MessageLog.Add(monster.Name + " can see you."); monster.TurnsAlerted = 1; game.Player.EngageCombat(monster); } } if (monster.TurnsAlerted.HasValue) { if (isPlayerLookingAway(monster, player)) { if (monster.Moves > 0 && monster.TurnsAlerted > 1) { RushPlayer(monster, commandSystem, game, dungeonMap, player, monsterFov); monster.Moves = 0; } else { // First Turn Makes Movement Visible to give player a chance to turn back monster.MovesCompleted = 10; monster.Moves = 10; } } else { monster.TurnsAlerted = 0; monster.Moves = 0; } } monster.TurnsAlerted++; if (monster.TurnsAlerted > 10) { if (!monsterFov.IsInFov(player.X, player.Y)) { game.Player.LeaveCombat(monster); } monster.TurnsAlerted = null; } return(true); }
// Use this for initialization void Start() { r = this.GetComponent <Rigidbody>(); commandIndex = 0; fov = this.GetComponentInChildren <FieldOfView>(true); agent = this.GetComponent <NavMeshAgent>(); }
public override void InitializeTrait(GameObject initGameObject) { gameObject = initGameObject; FieldOfView fov = gameObject.GetComponentInChildren <FieldOfView>(); fov.hasThirdEye = true; fov.viewRadiusThirdEye = viewRadius; fov.viewAngleThirdEye = viewAngle; }
public void setFOV(FieldOfView fov) { fov.origin = transform.position; if (value < 0) { value += 360f; } fov.startingAngle = (-90 + value) + (fov.fov / 2); }
void Start() { fov = GetComponent <FieldOfView>(); st = GetComponent <SearchTarget>(); ct = GetComponent <ChaseTarget>(); pf = GetComponent <PathFollower>(); fov.setTargetMask(targetMask); }
public bool Act(MonsterDTO monster, DungeonMapDTO map, PlayerDTO player, CommandSystem commandSystem) { var monsterFov = new FieldOfView(map); if (!monster.TurnsAlerted.HasValue) { monsterFov.ComputeFov(monster.X, monster.Y, monster.Awareness, true); if (monsterFov.IsInFov(player.X, player.Y)) { MessageLog.Add($"{monster.Name} is eager to fight {player.Name}"); monster.TurnsAlerted = 1; } } if (monster.TurnsAlerted.HasValue) { map.SetIsWalkable(monster.X, monster.Y, true); map.SetIsWalkable(player.X, player.Y, true); var pathFinder = new PathFinder(map); Path path = null; try { path = pathFinder.ShortestPath( map.GetCell(monster.X, monster.Y), map.GetCell(player.X, player.Y)); } catch (PathNotFoundException) { MessageLog.Add($"{monster.Name} waits for a turn"); } map.SetIsWalkable(monster.X, monster.Y, false); map.SetIsWalkable(player.X, player.Y, false); if (path != null) { try { commandSystem.MoveMonster(monster, map, player, path.Steps.First()); } catch (NoMoreStepsException) { MessageLog.Add($"{monster.Name} growls in frustration"); } } monster.TurnsAlerted++; if (monster.TurnsAlerted > 15) { monster.TurnsAlerted = null; } } return(true); }
public ChasePlayerState(GameObject obj) { stateID = StateID.CHASE; unit = obj.GetComponent <EnemyUnit>(); agent = obj.GetComponent <NavMeshAgent>(); fov = obj.GetComponent <FieldOfView>(); gun = obj.GetComponent <Gun>(); }
public BabyIdleState(StateMachine owner, SteeringBehavior steering, PerimeterController perimeterController, BabyStateScriptableObject stateData) { this.owner = owner; this.steeringBehavior = steering; this.perimeterController = perimeterController; fov = owner.GetComponent <FieldOfView>(); this.stateData = stateData; }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); if (fieldOfView == null) { Debug.LogWarning("DEVELOPER'S NOTE: No Field of View component found in Hunter behaviour of " + gameObject + ". Trying to add first one found in children."); fieldOfView = GetComponentInChildren <FieldOfView>(); } }
public MovementTutorialObjective(ObjectiveSystem objSys) : base(objSys) { tutorialTextComponent = objSys.tutorialText.GetComponent <TextMeshProUGUI>(); tutorialEnemyWeaponCollision = objSys.tutorialEnemyWeapon.GetComponent <EnemyWeaponCollision>(); playerCollision = objSys.playerObject.GetComponent <PlayerCollision>(); playerMovement = objSys.playerObject.GetComponent <PlayerMovementV2>(); tutorialEnemyFOV = objSys.tutorialEnemy.GetComponent <FieldOfView>(); playerControlScript = objSys.playerObject.GetComponent <PlayerControl>(); }
public bool Act(Monster monster, CommandSystem commandSystem) { DungeonMap dungeonMap = RogueGame.DungeonMap; Player player = RogueGame.Player; FieldOfView monsterFov = new FieldOfView(dungeonMap); if (!monster.TurnsAlerted.HasValue) { monsterFov.ComputeFov(monster.X, monster.Y, monster.Awareness, true); if (monsterFov.IsInFov(player.X, player.Y)) { RogueGame.MessageLog.Add($"{monster.Name} is eager to fight {player.Name}"); monster.TurnsAlerted = 1; } } if (monster.TurnsAlerted.HasValue) { dungeonMap.SetIsWalkable(monster.X, monster.Y, true); dungeonMap.SetIsWalkable(player.X, player.Y, true); PathFinder pathFinder = new PathFinder(dungeonMap); Path path = null; try { path = pathFinder.ShortestPath(dungeonMap.GetCell(monster.X, monster.Y), dungeonMap.GetCell(player.X, player.Y)); } catch (PathNotFoundException) { RogueGame.MessageLog.Add($"{monster.Name} waits for a turn"); } dungeonMap.SetIsWalkable(monster.X, monster.Y, false); dungeonMap.SetIsWalkable(player.X, player.Y, false); if (path != null) { try { commandSystem.MoveMonster(monster, path.StepForward()); } catch (NoMoreStepsException) { RogueGame.MessageLog.Add($"{monster.Name} waits for a turn"); } } monster.TurnsAlerted++; // Lose alerted status every 15 turns. As long as the player is still in FoV the monster will be realerted otherwise the monster will quit chasing the player. if (monster.TurnsAlerted > 15) { monster.TurnsAlerted = null; } } return(true); }
public void Awake() { sprite = GetComponent <SpriteRenderer>(); missileObjectPool = ObjectPoolManager.GetInstance().Get(objectPoolKey); // Debug.Log(missileObjectPool == null); view = GetComponent <FieldOfView>(); master = BoardMaster.GetInstance(); standard = master.destination.transform.position; }
// Use this for initialization void Start() { animator = GetComponent <Animator> (); fov = GetComponentInChildren <FieldOfView> (); sp = GetComponent <LaserCannonSP> (); //picker = GetComponentInChildren<ServerPicker> (); playerAimPos = shootLaser.position; }
private void Start() { turnManager = GameObject.Find("TurnManager").GetComponent <TurnManager>(); player = GameObject.Find("Player").GetComponent <PlayerActions>(); fieldOfView = GetComponent <FieldOfView>(); originalViewAngle = fieldOfView.viewAngle; ragazzoMuccaSoundPlayer = GetComponent <AudioSource>(); sprite = anim.GetComponent <SpriteRenderer>(); }
void OnSceneGUI() { FieldOfView fov = target as FieldOfView; if (fov && drawHandles) { DrawFieldOfView(fov.transform, fov.viewRadius, fov.viewAngle, fov.visibleTargets); } }
// Start is called before the first frame update void Start() { FOV = GetComponent <FieldOfView>(); agent = GetComponent <NavMeshAgent>(); manager = FindObjectOfType <GameManager>(); lastWpIndex = waypoints.Count - 1; targetPoint = waypoints[wpIndex]; }
public void Initialize(AIAgent agent) { _aiWeapon = agent.GetComponent <AIWeapons>(); _navAgent = agent.GetComponent <NavMeshAgent>(); _aiHealth = agent.GetComponent <AIHealth>(); _fov = agent.GetComponent <FieldOfView>(); _lastKnownLocation = GameObject.FindObjectOfType <LastKnownLocation>(); _agent = agent; }
public IdleState(GameObject go, StateMachine sm, List <IAIAttribute> attributes, Animator animator) : base(go, sm, attributes, animator) { //Debug.Log("Enemy with name " + _go.name + " is printing " + AIManager.current); //AIManager.current.OnAttackStateChangeReq += OnAttackStateChange; aiController = (AIController)_attributes.Find(x => x.GetType() == typeof(AIController)); _fieldOfView = (FieldOfView)_attributes.Find(x => x.GetType() == typeof(FieldOfView)); _fieldOfView.PlayerSpotted = false; }
private void Start() { coord = FindObjects.GameLogic.GetComponent <ConvertCoordinates>(); dungeon = FindObjects.GameLogic.GetComponent <DungeonBoard>(); actor = FindObjects.GameLogic.GetComponent <ActorBoard>(); mode = FindObjects.GameLogic.GetComponent <SubMode>(); fov = FindObjects.PC.GetComponent <FieldOfView>(); }
protected virtual void Start() { think = new Think(this); entityBehaviours = new Dictionary <BehaviourEnum, IEntityBehaviour>(); NavAgent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); fieldOfView = GetComponentInChildren <FieldOfView>(); NavAgent.speed = WalkSpeed; }
private void Awake() { fieldOfView = Instantiate(fieldOfViewPrefab); fieldOfView.zombie = gameObject; fieldOfView.OnRaycastHit += ZombieRaycastHit; fieldOfView.OnPlayerNotFound += PlayerNotFound; moveTowardsPlayer = GetComponent <MoveTowardsPlayer>(); fieldOfView.viewDistance = 20f; }
public EnnemyWanderState(StateMachine owner, SteeringBehavior steering, EnnemyStateScriptableObject stateData) { this.owner = owner; this.steeringBehavior = steering; this.controller = owner.GetComponent <EnnemyController>(); fov = owner.GetComponent <FieldOfView>(); this.stateData = stateData; }
private void Awake() { field = FindObjectOfType <FieldOfView>(); Rigidbody2D rigidbody2D1 = this.gameObject.GetComponent <Rigidbody2D>(); _rigidbody = rigidbody2D1; parentfrom = this.GetComponentInParent <ParentfromBullet>(); GenerateBullet(); }
void Start() { stats = GetComponentInChildren <statsBehaviour>(); fov = this.GetComponent <FieldOfView>(); prevDistance = fov.viewRadius; boca = gameObject.GetComponent <BoxCollider>(); StartCoroutine("FindResources", 0.5f); }