public Cannon(ContentManager content, Vector2 position, Stage stage, string enemytype) : base(content, position, stage, enemytype) { PlayerSpriteCollection spritecollection; spritecollectionlist = new List <PlayerSpriteCollection>(); Texture2D cannonTileset = content.Load <Texture2D>("Sprites/Enemies/Cannon"); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(TextureHelper.SwapColor(cannonTileset, new Color(192, 32, 0), new Color(184, 28, 12)), position, 5, Color.White, 1f); spritecollectionlist.Add(spritecollection); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(TextureHelper.SwapColor(cannonTileset, new Color(192, 32, 0), new Color(228, 68, 52)), position, 5, Color.White, 1f); spritecollectionlist.Add(spritecollection); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(cannonTileset, position, 5, Color.White, 1f); spritecollectionlist.Add(spritecollection); CollisionIsHazardous = false; _health = 15; _currentFrame = 0; _animatingforward = true; ExplosionAnimation.Initialize(content.Load <Texture2D>("Sprites/Explosion1"), position, 36, 36, 3, 150, Color.White, 1f, false, false, this.CurrentStage); ExplosionSound = content.Load <SoundEffect>("Sounds/Explosion1"); projectileTexture = content.Load <Texture2D>("Sprites/Projectiles/basicbullet"); _gun = new EnemyGun(this, projectileTexture); }
private void Start() { gun = GetComponent <EnemyGun>(); navigation = GetComponent <Navigation>(); enemyInfo = GetComponent <EnemyInfo>(); navMeshAgent = GetComponent <NavMeshAgent>(); }
private void Start() { agent = GetComponent <NavMeshAgent>(); enemyGun = GetComponent <EnemyGun>(); enemyInfo = GetComponent <EnemyInfo>(); //agent.SetDestination(agent.transform.position); }
protected override void Start() { //overrides start function of enemy.cs base.Start (); try { gun = transform.Find ("enemyGun").GetComponent<EnemyGun>(); } catch { //Debug.Log ("No 'enemyGun' found, looking for shotgun"); try { shotgun = transform.Find ("enemyShotgun").GetComponent<EnemyShotgun>(); } catch { //Debug.Log ("No 'enemyShotgun' found, looking for launcher"); try { launcher = transform.Find ("missilePoint").GetComponent<EnemyLauncher>(); } catch { //Debug.Log ("No 'enemyLauncher' found, looking for lobber"); try { lobber = transform.Find ("lobPoint").GetComponent<EnemyLobber>(); } catch { Debug.Log ("No gun attached to a shooting enemy"); } } } } }
void OnTriggerEnter2D(Collider2D hitinfo) { JumpSkull js = hitinfo.GetComponent <JumpSkull>(); EnemyGun eg = hitinfo.GetComponent <EnemyGun>(); Mines m = hitinfo.GetComponent <Mines>(); Boss b = hitinfo.GetComponent <Boss>(); Floor f = hitinfo.GetComponent <Floor>(); // Debug.Log(hitinfo.name); if (m != null) { m.TakeDamage(100); Destroy(gameObject); } if (eg != null) { eg.TakeDamage(50); Destroy(gameObject); } if (js != null) { js.TakeDamage(34); Destroy(gameObject); } if (b != null) { b.TakeDamage(20); Destroy(gameObject); } if (f != null) { Destroy(gameObject); } }
void Start() { gun = GetComponent <EnemyGun>(); target = mainPlayer.gameObject.transform.position; engine = GetComponent <Engine>(); gameObject.transform.position = patrolPath.transform.position; }
void Start() { controller = gameObject.GetComponent <CharacterController>(); movement = new MovementHelper.Movement(gameObject, controller , _moveAcc: 75f, _moveMax: 6.0, _friction: 40f, _gravity: 27f); moveDestination = gameObject.transform.position; aimAngleH = gameObject.transform.rotation.eulerAngles.y; aimAngleV = 0; floorPoint = transform.Find("Floor Point"); boxvis1 = new Vector3(0, 0, 0); boxvis2 = new Vector3(0, 0, 0); boxvis3 = Quaternion.identity; boxvis4 = new Vector3(0, 0, 0); boxvis5 = 0; linevis = new Vector3(0, 0, 0); playerObject = GameObject.FindGameObjectWithTag("Player"); gunInstance = gameObject.transform.Find("Enemy Gun").gameObject; gunScript = gunInstance.GetComponent <EnemyGun>(); //controller.enabled = false; }
private void Start() { gun = GetComponent <EnemyGun>(); navigation = GetComponent <Navigation>(); navMeshAgent = GetComponent <NavMeshAgent>(); audioSource = GetComponent <AudioSource>(); lightColor = light.color; }
private void Awake() { agent = GetComponent <NavMeshAgent>(); player = GameObject.Find("Player").transform; groundLayer = LayerMask.GetMask("Ground"); playerLayer = LayerMask.GetMask("Player"); gun = GetComponentInChildren <EnemyGun>(); }
public virtual void OnEnable() { player = GameObject.Find("EnemyTarget"); spr = GetComponent <SpriteRenderer>(); rb2d = GetComponent <Rigidbody2D>(); spr.sortingLayerName = "Player"; this.tag = "EnemyProjectile"; weapon = GameObject.Find("PH_EnemyWeapon").GetComponent <EnemyGun>(); initializeProjectileStats(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").transform; anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); enemyGun = GetComponentInChildren <EnemyGun>(); currentHealth = startingHealth; }
// Start is called before the first frame update void Start() { EnemyManager.instance.AddToEnemyList(gameObject); visionCollider = visionObject.GetComponent <Collider>(); eyes = gameObject.GetComponent <Eyes>(); enemyRB = gameObject.GetComponent <Rigidbody>(); enemyGun = gameObject.GetComponent <EnemyGun>(); //navMeshAgent = gameObject.GetComponent<NavMeshAgent>(); }
public virtual void Freeze() // Notar la potencial herencia en esta y las otras funciones. { animator = this.GetComponentInChildren <Animator>(); gun = this.GetComponentInChildren <EnemyGun>(); previousFireState = gun.holdFire; previousAnimationSpeed = animator.speed; animator.speed = 0; gun.holdFire = true; isFrozen = true; }
[SerializeField] private MeleeAttack _leftHand, _rightHand, _rightFoot; // Reference to melee attack scripts // ---------------------------------------------------------------------------------------------- // METHOD: Awake() // Desciption: Cahce component references, and convert the DeadZone float from degrees to radians // ----------------------------------------------------------------------------------------------- private void Awake() { _navAgent = GetComponent <NavMeshAgent>(); _anim = GetComponent <Animator>(); _enemyGun = GetComponentInChildren <EnemyGun>(true); _controller = GetComponent <StateController>(); _navAgent.updateRotation = false; // We will manually update the rotation through scripting in most cases DeadZone *= Mathf.Deg2Rad; }
// Use this for initialization public override void Start() { health = 550; startingHealth = health; SetHealth(startingHealth); maximumDistanceFromOrigin = 10; shootingDistance = 9f; selectedClass = enemyClass.Shooter; drtp = GetComponent <DrawRayToPlayer>(); eg = GetComponentInChildren <EnemyGun>(); }
public void SetDestination(float setX, float setY, float setZ) { destination = new Vector3(setX, setY, setZ); SetTarget(); gun = GetComponentInChildren <EnemyGun>(); gun.rotateSpeed = rotateSpeed; gun.shootDelay = fireRateDelay; gun.bullet = enemyBullet; throwDynamiteTimer = Random.Range(20.0f, 30.0f); }
public virtual void Freeze() { // Notar la potencial herencia en esta y las otras funciones. animator = this.GetComponentInChildren<Animator>(); gun = this.GetComponentInChildren<EnemyGun>(); previousFireState = gun.holdFire; previousAnimationSpeed = animator.speed; animator.speed = 0; gun.holdFire = true; isFrozen = true; }
void Start() { updatePath = 0; start = transform.position; distanceToGoal = 100; weaponScript = GetComponentInChildren <EnemyGun>(); agent = GetComponentInParent <NavMeshAgent>(); animator = GetComponent <Animator>(); agent.speed = 0.1f; }
void Start() { states = States.idle; player = FindObjectOfType <Player>().transform; gunSprite = enemyGun.GetComponentInChildren <SpriteRenderer>(); enemyGun = enemyGun.GetComponentInChildren <EnemyGun>(); sprite = GetComponentInChildren <SpriteRenderer>(); randomTime = Random.Range(5, 8); enemyGun.enabled = false; StartCoroutine(Walk()); StartCoroutine(DistanceCheck()); }
public Sniper(ContentManager content, Vector2 position, Stage stage, string enemytype) : base(content, position, stage, enemytype) { snipersprites = new PlayerSpriteCollection(); snipersprites.Initialize(content.Load <Texture2D>("Sprites/Enemies/Sniper"), position, 5, Color.White, 1f); ExplosionAnimation.Initialize(content.Load <Texture2D>("Sprites/Explosion1"), position, 36, 36, 3, 150, Color.White, 1f, false, false, this.CurrentStage); ExplosionSound = content.Load <SoundEffect>("Sounds/Explosion1"); projectileTexture = content.Load <Texture2D>("Sprites/Projectiles/basicbullet"); _gun = new EnemyGun(this, projectileTexture); }
override protected void Start() //overrides start function of enemy.cs { base.Start(); try { gun = transform.Find("enemyGun").GetComponent <EnemyGun>(); } catch { //Debug.Log ("No 'enemyGun' found, looking for shotgun"); try { shotgun = transform.Find("enemyShotgun").GetComponent <EnemyShotgun>(); } catch { Debug.Log("No gun attached to a shooting enemy"); } } }
// Use this for initialization void Start() { gun = GetComponent <EnemyGun>(); characterController = GetComponent <CharacterController>(); var rand = Random.value * 360.0f; randomDirection = new Vector3( Mathf.Cos(rand), 0.0f, Mathf.Sin(rand)); enabled = false; isBeforeMoveStart = true; }
IEnumerator Timer() { GameObject enemy = GameObject.FindGameObjectWithTag("Enemy"); enemyMovementController enemyScript = enemy.GetComponent <enemyMovementController>(); GameObject enemyGun = GameObject.FindGameObjectWithTag("Gun"); EnemyGun enemyGunScript = enemyGun.GetComponent <EnemyGun>(); enemyScript.speed = 0f; enemyGunScript.nextFire = 200f; yield return(new WaitForSeconds(8)); enemyScript.speed = 2.0f; enemyGunScript.nextFire = Time.time + enemyGunScript.fireRate; }
// Start is called before the first frame update void Start() { GameObject enemy = GameObject.FindWithTag("Player"); if (enemy == null) { Debug.Log("Cannot find Player"); } else { stun = enemy.GetComponent <Hack>(); } _agent = GetComponent <NavMeshAgent>(); _gun = GetComponent <EnemyGun>(); GoToNextPoint(); fanAudio.Play(); }
IEnumerator ShootPlayer() { EnemyGun enemyGun = childTransform.gameObject.GetComponent <EnemyGun>(); myTransform.LookAt(player); enemyGun.Shoot(); yield return(new WaitForSeconds(shootingFrequency)); myTransform.LookAt(player); enemyGun.Shoot(); yield return(new WaitForSeconds(shootingFrequency)); myTransform.LookAt(player); enemyGun.Shoot(); yield return(new WaitForSeconds(shootingFrequency * 3)); shooting = false; // EnemyGun shoots in the direction the enemy is facing }
public Turret(ContentManager content, Vector2 position, Stage stage, string enemytype) : base(content, position, stage, enemytype) { PlayerSpriteCollection spritecollection; Texture2D turrettileset; spritecollectionlist = new List <PlayerSpriteCollection>(); turrettileset = content.Load <Texture2D>("Sprites/Enemies/Turret"); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(TextureHelper.SwapColor(turrettileset, new Color(192, 32, 0), new Color(184, 28, 12)), position, 12, Color.White, 1f); spritecollectionlist.Add(spritecollection); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(TextureHelper.SwapColor(turrettileset, new Color(192, 32, 0), new Color(228, 68, 52)), position, 12, Color.White, 1f); spritecollectionlist.Add(spritecollection); spritecollection = new PlayerSpriteCollection(); spritecollection.Initialize(turrettileset, position, 12, Color.White, 1f); spritecollectionlist.Add(spritecollection); CollisionIsHazardous = false; _health = 15; _currentPosition = 3; TimeTargetLocked = 0.0f; _elapsedTime = 0; _currentFrame = 0; _animatingforward = true; // RGB colors for blinking animations of turret. //R 255 228 184 //G 140 68 28 //B 124 52 12 projectileTexture = content.Load <Texture2D>("Sprites/Projectiles/basicbullet"); ExplosionAnimation.Initialize(content.Load <Texture2D>("Sprites/Explosion2"), WorldPosition, 5, 150, Color.White, 1f, false, this.CurrentStage); ExplosionSound = content.Load <SoundEffect>("Sounds/Explosion2"); _gun = new EnemyGun(this, projectileTexture); }
// Update is called once per frame void Update() { transform.position += Vector3.right * Time.deltaTime * velocityX; if (Cam.transform.position.x >= -7.79f) { BouncyBoss enemyScript = Boss.GetComponent <BouncyBoss>(); EnemyGun enemyScript2 = TentacleSpawnloc.GetComponent <EnemyGun>(); EnemyGun enemyScript3 = TentacleSpawnloc2.GetComponent <EnemyGun>(); EnemyGun enemyScript4 = TentacleSpawnloc3.GetComponent <EnemyGun>(); enemyScript3.range = 100f; enemyScript4.range = 100f; enemyScript2.range = 100; enemyScript.delta = 2.5f; enemyScript.speed = 2f; enemyScript.moveSpeed = -0.09f; velocityX = 0f; } }
// Use this for initialization void Start() { gun = GetComponent<EnemyGun>(); characterController = GetComponent<CharacterController>(); var rand = Random.value * 360.0f; randomDirection = new Vector3( Mathf.Cos(rand), 0.0f, Mathf.Sin(rand)); enabled = false; isBeforeMoveStart = true; }
private void Start() { enemyInfo = transform.parent.GetComponent <EnemyInfo>(); gun = transform.parent.GetComponent <EnemyGun>(); }
private void Start() { rb = GetComponent <Rigidbody>(); enemyGun = FindObjectOfType <EnemyGun>(); playerLayerMask = LayerMask.GetMask("Player"); }