// Update is called once per frame void Update() { // This is going to get really hard. Check for player AND dead bodies // Behave differently when a body is spotted. //for(int i = 0; i < subjects.Count; ++i) //{ Vector2 origin = transform.position; // + rotator.FrontOffset(); Vector2 direction = (Vector2)player.transform.position - origin; targetSighted = false; float angle = Vector2.Angle(rotator.FrontOffset(), direction); // If player is in cone of vision, and there is an uninterrupted view // Or, if player is touching if ((angle < peripheralVision && ClearShot(origin, direction)) || GridMover.Touching(gameObject, player.gameObject)) { //rotator.FacePoint(player.GetDiscretePosition()); targetSighted = true; location = player.GetDiscretePosition(); // AutoMover should determine what to do with this information //mover.SetChasing(true); } /*if(Vector2.Distance(transform.position, player.transform.position) < 1.5f) * { * targetSighted = true; * location = player.GetDiscretePosition(); * rotator.FacePoint(player.GetDiscretePosition()); * mover.SetChasing(true); * }*/ //} }
// Start is called before the first frame update void Awake() { navigator = GetComponent <Navigator>(); fieldOfView = GetComponentInChildren <FieldOfView>(); //rotator = GetComponent<Rotator>(); mover = GetComponent <GridMover>(); }
// public GameObject marker; // Start is called before the first frame update void Start() { activeJobs = new List <KeyValuePair <JobHandle, PathfindingJob> >(); mover = GetComponent <GridMover>(); destination = transform.position; path = new List <Vector2>(); }
// Start is called before the first frame update void Start() { crossInstance = Instantiate(cross, transform.position, Quaternion.identity); crossInstance.GetComponent <SpriteRenderer>().enabled = false; source = GetComponent <AudioSource>(); shooter = GetComponent <Shooter>(); player = PlayerMover.instance.GetComponent <GridMover>(); }
// Start is called before the first frame update void Start() { if (isGoal) { transform.position = ReferenceHolder.instance.player.transform.position; } kaching = GetComponent <AudioSource>(); player = ReferenceHolder.instance.player.GetComponent <GridMover>(); }
private LayerMask mask; //~(1 << 9) & ~(1 << 10) & ~(1 << 11); // Start is called before the first frame update void Start() { //subjects = new List<GameObject>(); //subjects.Add(PlayerMover.instance.gameObject); mask = LayerMask.GetMask(new string[] { "Default", "Player" }); player = PlayerMover.instance.GetComponent <GridMover>(); mover = GetComponent <AutoMover>(); }
private void Grid_GridCreated(Grid grid) { if (controlledByPlayer) { gridMover = new GridWSADMover(this.transform, speed); } else { gridMover = new GridRequestedPathMover(this.transform, speed); } }
// Start is called before the first frame update void Start() { for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { GridMover grid = Instantiate(Grid, new Vector3(0, 0), Quaternion.identity).GetComponent <GridMover>(); grid.Init(i, j, Camera); } } }
// Start is called before the first frame update void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } instance = this; // Intentionally not using DestroyOnLoad rotator = GetComponent <Rotator>(); mover = GetComponent <GridMover>(); nav = GetComponent <Navigator>(); ClickManager.releaseHandler += _OnClick; // ClickHandler.DetectPlatform(); }
// public GameObject marker; // Start is called before the first frame update void Start() { crossInstance = Instantiate(cross, transform.position, Quaternion.identity); crossInstance.GetComponent <SpriteRenderer>().enabled = false; source = GetComponent <AudioSource>(); shooter = GetComponent <Shooter>(); player = ReferenceHolder.instance.player.GetComponent <GridMover>(); startAngle = GetComponent <Rotator>().GetAngle(); if (route.Count == 0) { route.Add(transform.position); } mover = GetComponent <GridMover>(); graph = MakeGraph(transform.position); destination = transform.position; SetChasing(false); }
private IEnumerator MoveCoroutine() { kingOriginalPosition = kingTrans.position; float t = 0; while (t < moveTime) { kingTrans.Translate(Vector3.right * moveSpeed * Time.deltaTime); GridMover playerGridMover = PlayerMovement.Instance.GetComponent <GridMover>(); playerGridMover.speed = moveSpeed; playerGridMover.Move(QuadDirection2D.right); t += Time.deltaTime; yield return(null); } CanvasSingleton.Instance.StartFadeOutAndIn(fadeOutSpeed, OnFadedOut, OnFadedIn); }
// PRIORITY: Stun > Alert > Suspicious > Idle // Idle -> Suspicious, Alert, Stun Standing, patroling, or returning to patrol // Suspicious -> Alert, Confuse, Stun Investigating noise, sighting, or corpse // Alert -> Suspicious, Confuse, Stun Chasing and attacking player // Confuse -> Idle, Suspicious, Alert, Stun Looking around after reaching origin of suspicious activity // Stun -> Suspicious Stunned after stun grenade // FieldOfView is only modified through SetMaterial; no state stuff needed // leashLength How far enemy will drift from its patrol; -1 for unlimited // addsPoints When true, enemy will add location of dead body to patrol // randomPatrol When true, enemy will cycle randomly through waypoints // tense When true, enemy will always run after first sighting // public GameObject marker; // Start is called before the first frame update void Awake() { mask = LayerMask.GetMask(new string[] { "Default", "Player" }); extraPoints = new List <Vector2>(); fieldOfView = GetComponentInChildren <FieldOfView>(); //rotator = GetComponent<Rotator>(); mover = GetComponent <GridMover>(); navigator = GetComponent <Navigator>(); player = PlayerMover.instance.GetComponent <GridMover>(); corpsesSeen = new List <GameObject>(); woundedSeen = new List <GameObject>(); transform.rotation = Quaternion.Euler(Vector3.zero); if (route.Count == 0) { route.Add(transform.position); } }
// Start is called before the first frame update void Start() { player = ReferenceHolder.instance.player.GetComponent <GridMover>(); mover = GetComponent <AutoMover>(); rotator = GetComponent <Rotator>(); }
// Start is called before the first frame update void Start() { source = GetComponent <AudioSource>(); ReferenceHolder.instance.player = gameObject; mover = GetComponent <GridMover>(); }
private void Awake() { gridMover = GetComponent <GridMover>(); }
void Start() { instance = this; }
protected override void Awake() { base.Awake(); gridMover = GetComponent <GridMover>(); }
// Start is called before the first frame update void Start() { rotator = GetComponent <Rotator>(); source = GetComponent <AudioSource>(); target = ReferenceHolder.instance.player.GetComponent <GridMover>(); }
void Start() { gridMover = Camera.main.GetComponent <GridMover>(); }