void Awake() { lR = GetComponent <LineRenderer>(); pm = GetComponent <PathMover>(); agent = GetComponent <NavMeshAgent>(); lR.positionCount = 0; }
void Start() { mover = new PathMover(0); mover.Path = Path; mover.PathLength = Path.Length; mover.StartMoving(Time.time, MoveSpeed); }
private void OnTriggerEnter(Collider other) { PathMover pathMover = other.GetComponent <PathMover>(); if (pathMover != null && !pathMover.hasCollided) { pathMover.isOnCashRegister = true; if (!ObjectiveTracker.Instance.ObjectivesCleared()) { Debug.Log("You Lose!"); ObjectiveTracker.Instance.ResetObjectives(); //PathCreator.Instance.ClearLineRenderer(); pathMover.isOnCashRegister = false; pathMover.canMove = false; // pathMover.transform.position = pathMover.startPosition; // pathMover.transform.rotation = pathMover.startRotation; pathMover.ResetTransform(); pathMover.points.Clear(); pathMover.traversedPoints.Clear(); pathMover.assignedPathCreator.ClearLineRenderer(); } else { winPanel.SetActive(true); } //PathCreator.Instance.ClearLineRenderer(); } }
private void OnCollisionEnter(Collision other) { //Debug.Log(other.collider.name + " collided with" + gameObject.name); if (other.gameObject.tag == "Player") { PathMover player = other.gameObject.GetComponent <PathMover>(); if (player != null) { player.HandlePlayerDuringCollision(); } Rigidbody rb = other.gameObject.GetComponent <Rigidbody>(); if (rb != null) { Vector3 direction = other.transform.position - transform.position; rb.AddForce(direction.normalized * knockbackStrength, ForceMode.Impulse); gameObject.GetComponent <MeshCollider>().convex = true; gameObject.GetComponent <Rigidbody>().isKinematic = false; gameObject.GetComponent <Rigidbody>().AddForce(-direction.normalized * knockbackStrength, ForceMode.Impulse); } } }
void Start() { Singleton = this; play = true; puthLVL = 0f; }
void Start() { mover = new PathMover(0); mover.Path = Path; mover.PathLength = Path.Length; mover.StartMoving(Time.time, MoveSpeed); }
public static XChangeLog Update(string path, string value) { var log = PathMover.Update(root, path, value); XChangeLogBank.GiveBack(log); return(log); }
public void ActivatelayerPath() { pathMover = GetComponent <PathMover>(); if (pathMover != null) { pathMover.enabled = false; } }
// Use this for initialization void Start() { //target = GameObject.Find("Player"); pathMover = GetComponent <PathMover>(); combat = GetComponent <Combat>(); pathMover.target = target.transform; inEngageRange = false; freeMove = true; }
void Awake() { playerNav = GetComponent <NavMeshAgent>(); pathMover = GetComponent <PathMover>(); var pathcreator = (PathCreator)FindObjectOfType(typeof(PathCreator)); if (pathcreator != null) { creator = pathcreator; } }
public async void MoveEntityTo(Point endPoint, Entity entity, Point tileSize, MoverManager moverManager, bool interact = false, Point?interactWith = null) { var searchParams = new SearchParameters(entity.Position.ToPoint(), endPoint, CollisionSystem, new Size(Map.Width, Map.Height)); await Task.Run(() => { var path = new AStarPathFinder(searchParams, _possibleMovements).FindPath(); var pathMover = new PathMover(entity, new FinitePath(path), new ExpiringSpatialHashMovementComplete <Entity>(_expiringSpatialHash, PlayerEntity.Instance)); pathMover.OnCancelEvent += (sender, args) => entity.MovingDirection = new Vector2(); if (interact && interactWith != null) { pathMover.OnCompleteEvent += (sender, args) => Interact(interactWith.Value); } moverManager.AddMover(pathMover); }); }
void Start() { mover = new PathMover(0); mover.Path = Path; mover.PathLength = Path.Length; mover.StartMoving(Time.time, MoveSpeed); reversePath = new Vector3[Path.Length]; int n = 0; for (int i = Path.Length - 1; i >= 0; --i) { reversePath[n] = Path[i]; } }
private void OnTriggerEnter(Collider other) { PathMover pathMover = other.GetComponent <PathMover>(); if (pathMover != null) { if (pathMover.isMainPlayer) { pathMover.canMove = false; pathMover.points.Clear(); pathMover.traversedPoints.Clear(); pathMover.ResetTransform(); } } }
public static List <XChangeLog> UpdateAll(List <XTransaction> list) { var ret = new List <XChangeLog>(); foreach (var t in list) { var log = PathMover.Update(root, t.path, t.val); ret.Add(log); } foreach (var log in ret) { XChangeLogBank.GiveBack(log); } return(ret); }
public void SetTarget(GameObject enemy, bool switchNow) { Debug.Log("Set"); if (switchNow) { if (enemy == null) { enemyTarget = null; } else { enemyTarget = enemy.GetComponent <PathMover>(); } } }
void Start() { mover = new PathMover(0); mover.Path = Path; mover.PathLength = Path.Length; mover.StartMoving(Time.time, MoveSpeed); reversePath = new Vector3[Path.Length]; int n = 0; for (int i = Path.Length - 1; i >= 0; --i) { reversePath[n] = Path[i]; } }
public void ConfigureOnPlacement(RoomHandler room) { gameObject.SetActive(true); enabled = true; IntVector2 SpawnPosition = (gameObject.transform.PositionVector2().ToIntVector2() - room.area.basePosition); Vector2 NodePosition = SpawnPosition.ToVector2(); SerializedPath SawBladePath = GenerateRectanglePathInset(NodePosition, PathNodeAreaSize); room.area.prototypeRoom.paths.Add(SawBladePath); DungeonPlaceable m_TrapPlacable = BraveResources.Load <DungeonPlaceable>("RobotDaveTraps", ".asset"); GameObject sawbladePrefab = null; if (m_TrapPlacable) { sawbladePrefab = m_TrapPlacable.variantTiers[0].nonDatabasePlaceable; } if (sawbladePrefab) { GameObject m_PlacedSawBlade = Instantiate(sawbladePrefab, gameObject.transform.position, Quaternion.identity); m_PlacedSawBlade.SetActive(false); if (m_PlacedSawBlade) { PathMover SawPathMover = m_PlacedSawBlade.GetComponent <PathMover>(); if (SawPathMover != null) { SawPathMover.RoomHandler = room; SawPathMover.Path = SawBladePath; SawPathMover.PathStartNode = Random.Range(0, SawBladePath.nodes.Count); SawPathMover.IsUsingAlternateTargets = false; SawPathMover.ForceCornerDelayHack = false; SawPathMover.nodeOffset = PathNodeOffset; m_PlacedSawBlade.SetActive(true); } } } }
private void OnTriggerEnter(Collider other) { PathMover pathMover = other.GetComponent <PathMover>(); if (pathMover != null) { if (ObjectiveTracker.Instance.ObjectivesCleared() && !pathMover.isOnCashRegister) { Debug.Log("You Lose!"); ObjectiveTracker.Instance.ResetObjectives(); pathMover.assignedPathCreator.ClearLineRenderer(); } else if (!ObjectiveTracker.Instance.ObjectivesCleared()) { Debug.Log("You Lose!"); ObjectiveTracker.Instance.ResetObjectives(); pathMover.assignedPathCreator.ClearLineRenderer(); } } }
bool AllSelectedPathsMatch() { if (m_SelectedElements.Count == 0) { return(true); } var firstElement = m_SelectedElements[0]; var firstPathMover = firstElement.GetComponent <PathMover>(); foreach (var element in m_SelectedElements) { var pathMover = element.GetComponent <PathMover>(); if (!PathMover.SamePath(firstPathMover, pathMover)) { return(false); } } return(true); }
static public bool SamePath(PathMover a, PathMover b) { if (a == null) { return(b == null); } if (b == null) { return(a == null); } var listA = a.m_IndexList; var listB = b.m_IndexList; if (listA == null) { return(listB == null); } if (listB == null) { return(listA == null); } if (listA.Count != listB.Count) { return(false); } for (var i = 0; i < listA.Count; ++i) { if (listA[i] != listB[i]) { return(false); } } return(true); }
// Start is called before the first frame update void Start() { timeManager = GameObject.Find("SceneManager").GetComponent <TimeManager>(); pathMover = GetComponent <PathMover>(); }
public void Start() { _mover = GetComponent <PathMover> (); }
public PathMovement(PathMover pathMover, IPlayerEventsNotifier playerEventsNotifier) { _pathMover = pathMover; _playerEventsNotifier = playerEventsNotifier; }
private void Awake() { mover = GetComponent <PathMover>(); timer = GetComponent <Timer>(); timer.OnTimerStopped += (t) => Unboost(); }
// Update is called once per frame void Update() { Ray playerRay = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit playerHitInfo; if (Physics.Raycast(playerRay, out playerHitInfo, Mathf.Infinity, playerLayer)) { //Debug.Log(playerHitInfo.collider.gameObject.name); PathMover player = playerHitInfo.collider.GetComponent <PathMover>(); if (player == targetPathMover) { //Debug.Log("Player Detected"); pathMover = player; lineRenderer.material = player.playerPathColor; } } else { //Debug.Log("Player Not Detected"); if (!isDrawingPath) { pathMover = null; } } if (pathMover != null) { if (Input.GetButtonDown("Fire1")) { pathMover.points.Clear(); pathMover.traversedPoints.Clear(); isDrawingPath = true; pathMover.canMove = false; } if (Input.GetButton("Fire1")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; //if(Physics.Raycast(ray, out hitInfo)){ if (Physics.Raycast(ray, out hitInfo, Mathf.Infinity, groundLayer)) { if (DistanceToLastPoint(hitInfo.point) > .5f) { pathMover.points.Add(hitInfo.point); pathMover.traversedPoints.Add(hitInfo.point); DisplayPath(); if (debugPath) { GameObject pathPoint = GameObject.Instantiate(pathObject); pathPoint.transform.position = hitInfo.point; pathPoints.Add(pathPoint); } } } } else if (Input.GetButtonUp("Fire1")) { OnNewPathCreated(points); if (pathMover.points.Count > 0) { pathMover.currentPoint = pathMover.points[0]; } isDrawingPath = false; pathMover.canMove = true; } } }
// Does the actual work of setting up the outline. // - Vector2Int index: the index of the tile being set up // - bool setUpNeighbors: whether this function should also be called // on this tile's neighbors void SetupHelper(Vector2Int index, bool setUpNeighbors) { // Note: there are some redundancies throughout this process, mostly // in cases where avoiding them would be a huge hassle resulting in // code that's much more difficult to read. Nothing about this algorithm // is particularly computationally expensive, so it's unlikely that // any benefit would be gained at all from "fixing" these redundancies. var code = 0; // This code will be the index to use to retrieve the appropriate // outline sprite from the appropriate dictionary. Each bit in this // code corresponds to a portion of the outline, either a corner or // an edge: // // 2----5----1 // | | // 6 4 // | | // 3----7----0 // // The code starts out at 0 (indicating no outline at all), but its // bits are turned on based on various checks to determine whether // that part of the outline should be active. // A code of 0 is a suitable default for an ordinary square, but // non-square tiles, such as diagonal slopes, should have different // starting bit patterns. // // If other tile shapes are added later, this system should accommodate // them properly, but additional ASCII drawings should be added as well. // For now, the drawings here will reflect only the shapes that we // already have. // No solid right means either // + +-+ // |\ or |/ // +-+ + if (!m_SolidRight) { // + if (m_SolidDown) // |\ { code |= 0b00000001; // +-0 <- set this bit } if (m_SolidUp) // +-1 <- set this bit { code |= 0b00000010; // |/ } } // + // No solid up means either // + + // /| or |\ // +-+ +-+ if (!m_SolidUp) { // 1 <- set this bit if (m_SolidRight) // /| { code |= 0b00000010; // +-+ } if (m_SolidLeft) // set this bit -> 2 { code |= 0b00000100; // |\ } } // +-+ // No solid left means either // +-+ + // \| or /| // + +-+ if (!m_SolidLeft) { // set this bit -> 2-+ if (m_SolidUp) // \| { code |= 0b00000100; // + } if (m_SolidDown) // + { code |= 0b00001000; // /| } } // set this bit -> 3-+ // No solid down means either // +-+ +-+ // |/ or \| // + + if (!m_SolidDown) { // +-+ if (m_SolidLeft) // |/ { code |= 0b00001000; // set this bit -> 3 } if (m_SolidRight) // +-+ { code |= 0b00000001; // \| } } // 1 <- set this bit // So far, all the setup we've done to prepare the code value has been based // on data present on this object itself, but now it's time to start looking // at our neighbors. // First we compute indices for all the neighboring grid elements var rdI = index + Vector2Int.right + Vector2Int.down; var ruI = index + Vector2Int.right + Vector2Int.up; var luI = index + Vector2Int.left + Vector2Int.up; var ldI = index + Vector2Int.left + Vector2Int.down; var rI = index + Vector2Int.right; var uI = index + Vector2Int.up; var lI = index + Vector2Int.left; var dI = index + Vector2Int.down; // Then we get the elements themselves from those indices var rd = s_TileGrid.Get(rdI); var ru = s_TileGrid.Get(ruI); var lu = s_TileGrid.Get(luI); var ld = s_TileGrid.Get(ldI); var r = s_TileGrid.Get(rI); var u = s_TileGrid.Get(uI); var l = s_TileGrid.Get(lI); var d = s_TileGrid.Get(dI); // Then we grab all the SolidEdgeOutliners of those elements, if any var rdO = rd.GetComponent <SolidEdgeOutliner>(); var ruO = ru.GetComponent <SolidEdgeOutliner>(); var luO = lu.GetComponent <SolidEdgeOutliner>(); var ldO = ld.GetComponent <SolidEdgeOutliner>(); var rO = r.GetComponent <SolidEdgeOutliner>(); var uO = u.GetComponent <SolidEdgeOutliner>(); var lO = l.GetComponent <SolidEdgeOutliner>(); var dO = d.GetComponent <SolidEdgeOutliner>(); // Now we get references to the PathMover components of each element, if any. // Outliners will treat objects with different paths as if they have // different outliner indices var pm = GetComponent <PathMover>(); var rdP = rd.GetComponent <PathMover>(); var ruP = ru.GetComponent <PathMover>(); var luP = lu.GetComponent <PathMover>(); var ldP = ld.GetComponent <PathMover>(); var rP = r.GetComponent <PathMover>(); var uP = u.GetComponent <PathMover>(); var lP = l.GetComponent <PathMover>(); var dP = d.GetComponent <PathMover>(); // Now that we have each neighboring outliner, we can proceed. The // overall idea here is that a bit should be set if the neighbor in the // corresponding direction is either not solid "toward" this tile, or the // equivalent thereof (e.g., it's null, etc.). Beyond that, experimentation // has revealed that there are a handful of additional conditions that // warrant turning on a bit, and those are checked here as well. // // Additionally, after looking at each neighbor and potentially modifying the // code value based on it, we also need to call SetupHelper on that neighbor // so that it has a chance to make its outline look right based on this tile // that is now being set up. Of course, in this case, SetupHelper is called // with its own setUpNeighbors flag false, so that we don't set this tile up // again and then set up the neighbor again and so on infinitely. // // A recent addition to this system adds the m_OutlineIndex property. If a // neighboring tile's outliner has a different outline index from this one's, // then it is not considered solid toward this tile. // // Finally, the newest change is that the outliner also takes the PathMover // component into account when deciding how to outline areas. If two objects // do not have the same path, then they are not outlined together // +----+..... // |this| rO . // +----+..... // . dO .rdO . // ........... if (rdO == null || rdO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, rdP) || rdO.m_BeingErased || (!rdO.m_SolidLeft || !rdO.m_SolidUp) || (rO != null && rO.m_OutlineIndex == m_OutlineIndex && rO.m_SolidLeft && !rO.m_SolidDown) || (dO != null && dO.m_OutlineIndex == m_OutlineIndex && dO.m_SolidUp && !dO.m_SolidRight)) { code |= 0b00000001; } // Set up rdO if appropriate else if (rdO != null && setUpNeighbors) { rdO.SetupHelper(rdI, false); } // ........... // . uO .ruO . // +----+..... // |this| rO . // +----+..... if (ruO == null || ruO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, ruP) || ruO.m_BeingErased || (!ruO.m_SolidLeft || !ruO.m_SolidDown) || (rO != null && rO.m_OutlineIndex == m_OutlineIndex && rO.m_SolidLeft && !rO.m_SolidUp) || (uO != null && uO.m_OutlineIndex == m_OutlineIndex && uO.m_SolidDown && !uO.m_SolidRight)) { code |= 0b00000010; } // Set up ruO if appropriate else if (ruO != null && setUpNeighbors) { ruO.SetupHelper(ruI, false); } // ........... // .luO . uO . // .....+----+ // . lO |this| // .....+----+ if (luO == null || luO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, luP) || luO.m_BeingErased || (!luO.m_SolidRight || !luO.m_SolidDown) || (lO != null && lO.m_OutlineIndex == m_OutlineIndex && lO.m_SolidRight && !lO.m_SolidUp) || (uO != null && uO.m_OutlineIndex == m_OutlineIndex && uO.m_SolidDown && !uO.m_SolidLeft)) { code |= 0b00000100; } // Set up luO if appropriate else if (luO != null && setUpNeighbors) { luO.SetupHelper(luI, false); } // .....+----+ // . lO |this| // .....+----+ // .ldO . dO . // ........... if (ldO == null || ldO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, ldP) || ldO.m_BeingErased || (!ldO.m_SolidRight || !ldO.m_SolidUp) || (lO != null && lO.m_OutlineIndex == m_OutlineIndex && lO.m_SolidRight && !lO.m_SolidDown) || (dO != null && dO.m_OutlineIndex == m_OutlineIndex && dO.m_SolidUp && !dO.m_SolidLeft)) { code |= 0b00001000; } // Set up ldO if appropriate else if (ldO != null && setUpNeighbors) { ldO.SetupHelper(ldI, false); } // +----+..... // |this| rO . // +----+..... if (rO == null || rO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, rP) || rO.m_BeingErased || !rO.m_SolidLeft) { code |= 0b00010011; } // Set up rO if appropriate else if (rO != null && setUpNeighbors) { rO.SetupHelper(rI, false); } // ...... // . uO . // +----+ // |this| // +----+ if (uO == null || uO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, uP) || uO.m_BeingErased || !uO.m_SolidDown) { code |= 0b00100110; } // Set up uO if appropriate else if (uO != null && setUpNeighbors) { uO.SetupHelper(uI, false); } // .....+----+ // . lO |this| // .....+----+ if (lO == null || lO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, lP) || lO.m_BeingErased || !lO.m_SolidRight) { code |= 0b01001100; } // Set up lO if appropriate else if (lO != null && setUpNeighbors) { lO.SetupHelper(lI, false); } // +----+ // |this| // +----+ // . dO . // ...... if (dO == null || dO.m_OutlineIndex != m_OutlineIndex || !PathMover.SamePath(pm, dP) || dO.m_BeingErased || !dO.m_SolidUp) { code |= 0b10001001; } // Set up dO if appropriate else if (dO != null && setUpNeighbors) { dO.SetupHelper(dI, false); } // Now we're done with our neighbors, and it's time for more // introspection. We're going to be turning bits off this time. A // slope tile without a solid top, for example, should certainly // not have the top of its outline drawn, regardless of what's // going on with its neighbors. We also want to turn corner bits // off for similar reasons. // // Here's this diagram, once again: // // 2----5----1 // | | // 6 4 // | | // 3----7----0 if (!m_SolidRight) // No solid right means turn off bit 4 { code &= ~(0b00010000); if (!m_SolidDown) // No solid right && no solid down means turn off bit 0 { code &= ~(0b00000001); } if (!m_SolidUp) // No solid right && no solid up means turn off bit 1 { code &= ~(0b00000010); } } if (!m_SolidUp) // No solid up means turn off bit 5 { code &= ~(0b00100000); if (!m_SolidRight) // No solid up && no solid right means turn off bit 1 { code &= ~(0b00000010); } if (!m_SolidLeft) // No solid up && no solid left means turn off bit 2 { code &= ~(0b00000100); } } if (!m_SolidLeft) // No solid left means turn off bit 6 { code &= ~(0b01000000); if (!m_SolidUp) // No solid left && no solid up means turn off bit 2 { code &= ~(0b00000100); } if (!m_SolidDown) // No solid left && no solid down means turn off bit 3 { code &= ~(0b00001000); } } if (!m_SolidDown) // No solid down means turn off bit 7 { code &= ~(0b10000000); if (!m_SolidLeft) // No solid down && no solid left means turn off bit 3 { code &= ~(0b00001000); } if (!m_SolidRight) // No solid down && no solid right means turn off bit 0 { code &= ~(0b00000001); } } // Oookay. One last bit of potential code manipulation: // // The outline on every tile is an interior stroke -- that is, // it doesn't spill out of the visible area of the tile itself. // (This is true whether it's a solid square tile or any other // shape.) // // Now, the placement of the outline pixels within the sprites // themselves is in most cases entirely determinable by the // bits that have been set, and thus by the code value // determined thereby; that is, in a slope tile with, say, bits // 0, 1, 3, and 4, set, it unambiguously specifies the shape: // // + // / | // / | // + + // // However, when the bits get set like this: // // + + // / or \ // / \ // + + // // ...is this a ceiling? Or is it a floor? You can't tell by // the code bits alone (unlike in any other case). And it // matters, because the outline pixels of the slope part of a // ceiling slope tile are not in the same part of the sprite // as the outline pixels of the slope part of a floor slope. // // So, to handle this situation, which comes about only when // this is a slope tile where no bits got set in checking // neighbors (and no bits got cleared afterward), we determine // whether this is a ceiling tile based on the solidity flags // and then use the special code value of -1 if it's a ceiling. // So, to recap all of that: // IF: // - it's a slope tile, determined opposite sides having // opposite solidities, AND // - it's a ceiling slope, determined by the top being // solid, AND // - the code value is unmodified from its initial state, // so it's either 0000 0101 or 0000 1010, // THEN: // - we set the code to be the special code value of -1. if (m_SolidUp && !m_SolidDown && m_SolidRight != m_SolidLeft && (code == 0b00000101 || code == 0b00001010)) { code = -1; } // Now that all of the fuss about the code is through, it's // time to interpret it and use it to get the appropriate // sprite for the outline renderer. // First of all, if the code is 0, then there's no outline // at all, and so we should just turn the damn thing off if (code == 0) { m_SpriteRenderer.enabled = false; } else { // Otherwise, the renderer should be enabled m_SpriteRenderer.enabled = true; // We'll use the solidity flags to determine which dictionary // to look in to find the correct outline sprite Dictionary <int, Sprite> sprites = null; // If all four sides are solid, then it's a square if (m_SolidRight && m_SolidUp && m_SolidLeft && m_SolidDown) { sprites = s_SquareSprites; } // Otherwise, if opposite sides have opposite solidities, // then it's one of the two kinds of slope tile else if (m_SolidRight != m_SolidLeft && m_SolidUp != m_SolidDown) { // If the right side has the same solidity as the bottom, // then it's a left-down-to-right-up slope if (m_SolidRight == m_SolidDown) { sprites = s_LDtoRUSlopeSprites; } // Otherwise, it's a left-up-to-right-down slope else { sprites = s_LUtoRDSlopeSprites; } } // Finally, we index the chosen dictionary and assign the // sprite we get from it to the outline renderer. m_SpriteRenderer.sprite = sprites[code]; } }
void Awake() { Instance = this; }
public void setUp(Transform newHead, RagDollController newRagdoll, Transform[] newAccessories) { head = newHead; ragDoll = newRagdoll; accessories = newAccessories; pathMover = GetComponent<PathMover>(); player = GameObject.FindWithTag ("Player").transform; GameObject guardRoomObj = GameObject.FindWithTag("GuardRoom"); if (guardRoomObj) guardRoom = guardRoomObj.GetComponent<GuardRoom>(); enemyAI = GetComponent<EnemyAI>(); enemyAnimator = GetComponent<EnemyAnimator>(); characterController = GetComponent<CharacterController>(); startWalking(); Events.Listen(gameObject, "SoundEvents"); //color the minimap dot Transform miniMapDot = transform.Find("MiniMapUnit"); if (miniMapDot) { switch (EnemyType) { case EnemyTypes.Guard : miniMapDot.renderer.material.color = Color.red; break; case EnemyTypes.Janitor : miniMapDot.renderer.material.color = Color.cyan; break; default : miniMapDot.renderer.material.color = Color.black; break; } miniMapDot.renderer.material.renderQueue = 3000 + Random.Range(1, 500); } }
void Start() { pathMover = new PathMover(gameObject, 8f); animator = GetComponent <Animator>(); }
void Start() { Events.Listen(gameObject, "GuardRadio"); enemyController = GetComponent<EnemyController>(); enemyAnimator = GetComponent<EnemyAnimator>(); pathMover = GetComponent<PathMover>(); if (!enemyAnimator) print ("ERROR: No enemy animator"); }