public static void ReportOnFakeSoulChasing(EnemyPatrol fakeSoul) { if (OnFakeSoulChasing != null) { OnFakeSoulChasing(fakeSoul); } }
private void Start() { _enemypatrol = GetComponentInParent <EnemyPatrol>(); myCollider = GetComponent <SphereCollider>(); myCollider.radius = agroRad; myCollider.isTrigger = true; }
void OnFakeSoulChasing(EnemyPatrol fakesoul) { if (fakesoul == this) { StartCoroutine(FakeSoulActivate()); } }
void OnCollisionEnter2D(Collision2D target) { // Platform collision if (target.gameObject.tag == TagManager.GROUND_TAG || target.gameObject.tag == TagManager.ENEMY_TAG) { ResetDoubleJump(); } // Enemies Collision // reduce HP if (target.gameObject.tag == TagManager.ENEMY_TAG || target.gameObject.tag == TagManager.OBSTACLE_TAG) { EnemyPatrol enemyPatrol = target.gameObject.GetComponent <EnemyPatrol>(); if (enemyPatrol) { playerHealth.TakeDamage(enemyPatrol.damage); } else { playerHealth.TakeDamage(20f); } } //if reach finishline if (target.gameObject.tag == TagManager.FINISHLINE) { ; LevelManager.instance.LoadNextLevel(); } }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); ePatrol = GetComponent <EnemyPatrol>(); eManager = GetComponent <EnemyManager>(); myrigidbody2D = GetComponent <Rigidbody2D>(); }
void Start() { agent = GetComponent <NavMeshAgent>(); patrol = GetComponent <EnemyPatrol>(); enemySenses = GetComponent <EnemySenses_3>(); anim = GetComponent <EnemyAnimation>(); enemyStats = new EnemyStats(); aiActive = true; alarmActive = false; aware = false; gameOver = false; player = GameObject.FindGameObjectWithTag("Player"); manager = FindObjectOfType <Manager>(); stats = FindObjectOfType <Statistics>(); if (isReinforcment) { aiActive = false; } if (currentState != null && aiActive) { aiActive = true; TransitionToState(currentState); } //anim.AnimationWalk(); }
public void Start() { isAware = false; agent = GetComponent <NavMeshAgent>(); renderer = GetComponent <Renderer>(); enemyPatrol = GetComponent <EnemyPatrol>(); }
// Update is called once per frame void Update() { if (timeBtwAttack <= 0) { //then can attack if (Input.GetKey(KeyCode.Return)) { //anime.SetBool("attack", true); Collider2D[] attackables = Physics2D.OverlapCircleAll(attackPos.position, attackRange, attackable); for (int i = 0; i < attackables.Length; i++) { EnemyPatrol enemy = attackables[i].GetComponent <EnemyPatrol>(); if (enemy != null) { enemy.takeDamage(damage); } } } timeBtwAttack = startTimeBtwAttack; } else { //anime.SetBool("attack", false); timeBtwAttack -= Time.deltaTime; } }
void Start() { agent = GetComponent <NavMeshAgent>(); EnemyPatrol = new EnemyPatrol(agent, patrolPoints); PlayerCombat = new Combat( transform: transform, adversaryLayers: playerLayers, attackRadius: attackRange); Visibility = new EnemyVisibility( transform: transform, target: target, maxAngle: visibilityAngle, maxDistance: visibilityDistance, ignoreLayers: visibilityIgnoreLayers); Hearing = new EnemyHearing( transform: transform, target: target, maxDistance: hearingDistance ); state = State.None; }
void OnTriggerEnter2D(Collider2D hitInfo) { EnemyPatrol enemy = hitInfo.GetComponent <EnemyPatrol>(); if (enemy != null) { enemy.TakeDamage(damage); } Destroy(gameObject); EnemyFollow enemy1 = hitInfo.GetComponent <EnemyFollow>(); if (enemy1 != null) { enemy1.TakeDamage(damage); } Destroy(gameObject); EnemyAttack enemy2 = hitInfo.GetComponent <EnemyAttack>(); if (enemy2 != null) { enemy2.TakeDamage(damage); } Destroy(gameObject); }
// Use this for initialization void Start() { //retrieves the navmesh agent component and assigns it to the space we made earlier agent = GetComponent <NavMeshAgent>(); //Check for the enemy patrol script. Returns null if one isn't attached. EnemyPatrol = GetComponent <EnemyPatrol>(); }
void Awake() { patrolBehaviour = GetComponent <EnemyPatrol>(); chaseBehaviour = GetComponent <EnemyChase>(); // Turn off the chase behaviour to start with chaseBehaviour.enabled = false; }
override public void Execute(EnemyAI enemyAi) { enemyAi.Trace(); if (!enemyAi.bSight()) { enemyAi.ChangeState(EnemyPatrol.Instance()); } }
// Start is called before the first frame update protected virtual void Awake() { myRB = GetComponent <Rigidbody2D>(); mySpriteRenderer = GetComponent <SpriteRenderer>(); myEnemyPatrol = GetComponent <EnemyPatrol>(); myAnimator = GetComponent <Animator>(); player = FindObjectOfType <Player>(); }
private void Start() { anim = GetComponentInChildren <Animator>(); enemyPatrol = GetComponent <EnemyPatrol>(); if (isBoss) { keyfab.SetActive(false); } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; nav = GetComponent <NavMeshAgent>(); enemyAi = GetComponent <EnemyAI>(); health = GetComponent <EnemyHealth>(); currentState = EnemyPatrol.Instance(); }
// awake is called when the script loads void Awake() { //get the behaviours so we can turn them off and on patrolBehaviour = GetComponent <EnemyPatrol>(); chaseBehaviour = GetComponent <EnemyChase>(); // Turn off the chase behaviour to start with chaseBehaviour.enabled = false; }
private void Awake() { if (GetComponent <EnemyPatrol>() != null) { enemyPatrol = GetComponent <EnemyPatrol>(); } enemy = GetComponent <Enemy>(); player = FindObjectOfType <PlayerController>().transform; }
void ResetEnemies() { foreach (GameObject enemy in resetEnemiesPosition) { enemyPatrol = enemy.GetComponent <EnemyPatrol>(); enemyPatrol.SetPlayerDetected(false); enemyPatrol.ResetPosition(); } }
public cNivComplexeScientifique(IServiceProvider serviceProvider, GraphicsDeviceManager graphics) : base(serviceProvider, graphics) { m_PatrolSoldierPatrolData = new EnemyPatrolData(400f, 1, GameResources.RifleSoldierPatrouilleAnimation); /// Ennemi outbase EnnemiPatrouille1 = new EnemyPatrol(GameResources.RifleSoldierPatrouille, new Vector2(500, 480), m_PatrolSoldierPatrolData); EnnemiPatrouille2 = new EnemyPatrol(GameResources.RifleSoldierPatrouille, new Vector2(600, 480), m_PatrolSoldierPatrolData); }
private void Start() { sphereCollider = GetComponent <SphereCollider>(); patrol = GetComponent <EnemyPatrol>(); nav = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); Physics.queriesHitBackfaces = false; enemyOfenemy = player.transform; }
private void Awake() { if (instance != null) { Debug.LogWarning("There is already an instance of EnemyPatrol in the scene."); return; } instance = this; }
// ------------------------------------------------ // Awake is called when the script is loaded // ------------------------------------------------ void Awake() { // Get the EnemyPatrol that we'll be using for AI patrolBehaviour = GetComponent <EnemyPatrol>(); // Get the EnemyPatrol that we'll be using for AI chaseBehaviour = GetComponent <EnemyChase>(); // Turn off the chase behaviour to start with: chaseBehaviour.enabled = false; }
// Use this for initialization void Start() { anim = gameObject.GetComponent <Animator>(); inRangeScript = GetComponent <CheckPlayerInRange>(); enemyPatrolScript = GetComponent <EnemyPatrol>(); moveSpeedStart = enemyPatrolScript.moveSpeed; HealthScript = GetComponent <EnemyHealthMid>(); enemyHealthStart = HealthScript.enemyHealth; enemyHealthBuff = enemyHealthStart + enemyHealthStart; }
void Awake() { try { EP = gameObject.GetComponent <EnemyPatrol>(); } catch { EP = null; } }
void OnTriggerEnter2D(Collider2D hitInfo) { EnemyPatrol enemy = hitInfo.GetComponent <EnemyPatrol>(); if (enemy != null) { enemy.TakeDamage(damage); } Destroy(gameObject); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent <PlayerHealth>(); enemyHealth = GetComponent <Health>(); nav = GetComponent <UnityEngine.AI.NavMeshAgent>(); sight = GetComponentInChildren <EnemyFOV>(); anim = GetComponent <Animator>(); attack = GetComponent <IAttack>(); enemyPatrol = GetComponent <EnemyPatrol>(); }
// Start is called before the first frame update void Start() { slider = transform.parent.Find("EnemyAnimator/Canvas/Slider").gameObject.GetComponent <Slider>(); player = LevelAccess.GetPlayerPos(); patrol = GetComponent <EnemyPatrol>(); visibility = player.GetComponent <PlayerVisibility>(); catchAmount = 0f; caught = false; outside = true; slider.gameObject.SetActive(false); gfc = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>(); }
// Start is called before the first frame update void Start() { enemy = FindObjectOfType <EnemyPatrol> (); patenemy = FindObjectOfType <HaatacholaEnemy> (); player = FindObjectOfType <PlayerMovement> (); slinghit = false; if (player.transform.localScale.x < 0) { speed = -speed; //rotationSpeed = -rotationSpeed; } }
void Start() { viewMesh = new Mesh(); viewMesh.name = "view Mesh"; viewMeshFilter.mesh = viewMesh; _targetObject = GameObject.Find("Player"); // GameObject.FindGameObjectsWithTag("player"); _guardObject = GameObject.Find("guard"); _targetScript = _targetObject.GetComponent <MorphController>(); _guardScript = _guardObject.GetComponent <EnemyPatrol>(); StartCoroutine("FindTargetsWithDelay", .2f); }
public void ClearActiveEnemy() { activeEnemy = null; GameState.Instance.HidePrompt(); }
public void UpdateActiveEnemy( EnemyPatrol enemy ) { activeEnemy = enemy; GameState.Instance.ShowPrompt( "Press E to take down enemy" ); }
/* * =========================================================================================================== * UNITY'S STUFF * =========================================================================================================== */ /// <summary> /// When the script is initialized /// </summary> void Awake() { if(this.droneType == eDroneType.Patrol){ patrolDroneScript = this.gameObject.GetComponent<DronePatrol>(); //patrolScript = this.gameObject.GetComponent<Patrol>(); } else if(this.droneType == eDroneType.Saboteur) saboteurScript = this.gameObject.GetComponent<Saboteur>(); // Check if it is a CPU controlled drone (or opponent drones, for that matter) if(this.gameObject.layer == MainScript.enemyLayer) { // Set a flag to make easier for us isThisAnEnemyDrone = true; // Check the type and get the component // AI hunter drone if(this.droneType == eDroneType.Hunter) { hunterAIScript = this.gameObject.GetComponent<DroneHunter>(); captureSpot = GetCaptureSpot(); captureRaySpot = GetCaptureRaySpot(); if(!hunterAIScript) { // DEBUG Debug.LogError("DroneHunter component not found in " + this.transform); } } if(this.droneType == eDroneType.Patrol) { enemyPatrolScript = this.gameObject.GetComponent<EnemyPatrol>(); // Set a flag to make easier for us //isThisAnEnemyDrone = true; } } sabotageTime = 2.0f; // Set the default settings for all the drones if(!isThisAnEnemyDrone) Selectable = true; // All drones are selectable Movable = true; // All drones are movable Type = eObjType.Drone; AIScript = gameObject.GetComponent<AstarAIFollow>(); // FSM setup eFSMCurrentState = FSMState.STATE_IDLE; // Starts the object variables, like the sweet spot and the main mesh object GetSweetSpotAndMeshObject(); // Get info about the collider GetColliderInfo(); }
// Use this for initialization void Start() { enemyPatrol = GetComponentInParent<EnemyPatrol> (); }