private IEnumerator EnemySpawn() { yield return(new WaitForSeconds(2)); enemySpawn = GameObject.Instantiate(enemyToSpawn); Vector3 enemyPos = this.gameObject.transform.position; enemyPos.y -= 2; if (spawnFront) { enemyPos.z -= 4.5f; } else { enemyPos.z += 4.5f; } StartCoroutine(SpawnDirt(enemyPos)); yield return(new WaitForSeconds(1)); enemySpawn.transform.position = enemyPos; enemyRb = enemySpawn.GetComponent <Rigidbody>(); enemyCollider = enemySpawn.GetComponent <BoxCollider>(); enemyAI = enemySpawn.GetComponent <MovementAI>(); enemyAI.jumpEnabled = false; enemyCollider.enabled = false; enemyRb.useGravity = false; enemyAI.trackingEnabled = false; spawnController.AddEnemy(); this.activateSpawn = true; }
// Use this for initialization void Start() { movementScript = GameObject.FindGameObjectWithTag("AI").GetComponent<MovementAI>(); myMoveData = GetComponent<MovementData>(); myMoveData.position = transform.position; myMoveData.velocity = new Vector3(1,0,0); }
public void Die() { if (isLocalPlayer) { PlayerCanvas.canvas.WriteGameStatusText("Respawn in " + respawnTime + " seconds"); PlayerCanvas.canvas.PlayDeathAudio(); } DisablePlayer(); Debug.Log("There are " + AIToNotifyWhenYouDie.Count + " to notify of death."); for (int i = 0; i < AIToNotifyWhenYouDie.Count; i++) { Debug.Log("Notifying " + AIToNotifyWhenYouDie[i].name); MovementAI AIToNotify = AIToNotifyWhenYouDie[i].GetComponent <MovementAI>(); if (AIToNotify != null) { AIToNotify.NotifyOfDeath(this.gameObject); } else { TurretAI TurretToNotify = AIToNotifyWhenYouDie[AIToNotifyWhenYouDie.Count - 1].GetComponent <TurretAI>(); if (TurretToNotify != null) { TurretToNotify.NotifyOfDeath(this.gameObject); } } } playerFlagHolder.DropFlags(); Invoke("Respawn", respawnTime); }
private void OnTriggerEnter(Collider other) { if (other.gameObject != this.gameObject) { //Debug.Log("Hit a thing!"); PlayerHealth healthScriptToDamage = other.gameObject.GetComponent <PlayerHealth>(); MovementAI AIToAlert = other.gameObject.GetComponent <MovementAI>(); //Debug.Log(other.gameObject.name); if (healthScriptToDamage != null) { //Debug.Log("Got a script!"); healthScriptToDamage.TakeDamage(); if (AIToAlert != null) { AIToAlert.TurnToCheckASpot(this.gameObject.transform.position - this.gameObject.transform.forward); } } else if (other.gameObject.tag == "Destructable") { Health enemyHealth = other.transform.GetComponent <Health>(); if (enemyHealth != null) { //Debug.Log("It will be hurt."); enemyHealth.TakeDamage(); } } RpcDestroyBullet(); NetworkServer.UnSpawn(this.gameObject); NetworkServer.Destroy(this.gameObject); } }
void Start() { attackAI = gameObject.GetComponent<AttackAI>(); movementAI = gameObject.GetComponent<MovementAI>(); breakable = gameObject.GetComponentInChildren<BreakableManager>(); if (entityType == EntityType.Enemy) { AutoAlign(); } }
//[SerializeField] GameObject[] patrolWaypoints; void Start() { movementAI = GetComponent <MovementAI>(); controllerAI = GetComponent <ControllerAI>(); playerObj = FindObjectOfType <Player>().gameObject; boxCollider = GetComponent <BoxCollider>(); }
// Use this for initialization void Awake() { _movementScript = GameObject.FindGameObjectWithTag("AI").GetComponent<MovementAI>(); _myMoveData = GetComponent<MovementData>(); _targetMoveData = target.GetComponent<MovementData>(); _myMoveData.position = transform.position; _currentHp = _maxHp; anime = GetComponent<Animator>(); }
void Start() { this.direction = this.transform.eulerAngles; this.position = this.transform.position; this.currentSpeed = 0.0f; targetDetected = targetCanBeSeen = false; movementAI = GetComponent <MovementAI>(); }
void Start() { attackAI = gameObject.GetComponent <AttackAI>(); movementAI = gameObject.GetComponent <MovementAI>(); breakable = gameObject.GetComponentInChildren <BreakableManager>(); if (entityType == EntityType.Enemy) { AutoAlign(); } }
void Start() { centerTransform = transform.GetChild(0); centerTransform.rotation = transform.rotation; this.direction = this.transform.eulerAngles; this.position = this.transform.position; this.currentSpeed = 0.0f; targetDetected = targetCanBeSeen = targetInLineOfSight = targetInShootingRange = false; movementAI = GetComponent <MovementAI>(); Equipment weapon = Instantiate(weaponPrefab, Vector3.zero, Quaternion.Euler(0, 0, 0)).GetComponent <Equipment>(); GetComponent <EquipAction>().OnEquip(weapon, this.centerTransform); }
void Start() { centerTransform = transform.GetChild(0); centerTransform.rotation = transform.rotation; this.direction = this.transform.eulerAngles; this.position = this.transform.position; this.currentSpeed = 0.0f; targetDetected = targetCanBeSeen = targetInLineOfSight = targetInShootingRange = false; movementAI = GetComponent <MovementAI>(); GameObject weaponObject = Instantiate(weaponPrefab); RangeWeapon weapon = weaponObject.GetComponent <RangeWeapon>(); equipAction = GetComponent <EquipAction>(); equipAction.EquipItem(weapon, this.centerTransform); }
public Enemy(Dictionary <string, Animation> animations, Vector2 position, EnemyType type) : base(animations, position) { autoAttack = SpellDepository.RangeAutoAttack(this); Spells = new List <Spell>(); InitSpells(); Scale = 1f; baseSpeed = 1.5f; Faction = Faction.ENEMY; XPDrop = 20; movementAI = new MovementAI(CollisionPolygon, this); EnemyType = type; currentState = new WanderState(this); SightRange = 600; autoAttackRange = 350; baseAttackSpeed = 2f; Debug.Assert(SightRange > autoAttackRange, "Cant shoot target, when u dont see it."); }
void Start() { InitializeEntity(); AutoTarget = new AstralProjection(gameObject); canAttack = true; if (attackingg == null) { attackingg = GameObject.FindGameObjectWithTag("Player"); attacking = attackingg.GetComponent <Entities>(); } mapgen = GameObject.FindGameObjectWithTag("MapGen").GetComponent <MakeMap>(); initFloor = mapgen.DungeonFloor; ai = new MovementAI(mapgen.currentFloor()); isWandering = true; isBlindlyChasing = false; /* * path = ai.getPath (gameObject.transform.position, attackingg.transform.position); * ai.currentNode = path.pop (); */ }
public PathfindToLocationTask(PathfindData pathfindData) { _pathfindData = pathfindData; _movementAI = new MovementAI(pathfindData.Character, new AStarPathfinding()); }
void Awake() { thisTransform = transform.position; moveAI = gameObject.GetComponent <MovementAI>(); }
// Use this for initialization void Start() { enemy = GetComponentInParent <MovementAI>(); // Different to way player's health bar finds player healthBarRawImage = GetComponent <RawImage>(); }
// Use this for initialization void Start() { MvmentAI = GetComponent <MovementAI>(); TurrentAI = GetComponentsInChildren <TurrentMoveAI>(); BarrelAI = GetComponentsInChildren <BarrelMoveAI>(); }
void Start() { interactor = GetComponent <Interactor>(); movementAI = GetComponent <MovementAI>(); layerHandler = GameObject.FindGameObjectWithTag("LayerHandler").GetComponent <LayerHandler>(); }
void Start() { movementAI = GetComponent <MovementAI>(); }
// Use this for initialization void Start() { wheelRotateSpeed = 120.0f; moveAI = GetComponentInParent <MovementAI>(); stickToGround = true; }
private void Awake() { movementAI = GetComponent <MovementAI>(); botFSM = GetComponent <BotFSM>(); }
// Use this for initialization void Start() { movement = GetComponent<MovementAI>(); animator = GetComponent<Animator> (); control = GetComponent<MonstersControl>(); }
//Start is called before the first frame update void Awake() { col = GetComponent <SphereCollider>(); moveAI = GetComponent <MovementAI>(); originalTarget = moveAI.target; }
// Use this for initialization void Start() { enemy = GetComponent<Enemy> (); rigidbody2d = GetComponent<Rigidbody2D>(); movement = GetComponent<MovementAI> (); }
// Use this for initialization void Start() { movementScript = GameObject.FindGameObjectWithTag("AI").GetComponent<MovementAI>(); myMoveData = GetComponent<MovementData>(); }