void Start() { SU = GameObject.Find("StartBattle").GetComponent<SpawnUnit>(); EA = this.gameObject.GetComponent<EnemyAttack>(); CurHp = MaxHp; anim = GetComponent<Animator>(); }
public void Start() { // получаем компоненты у игрока и его характеристики PlCh = GameObject.Find("-Characteristics-").GetComponent<PlayerCharacteristics>(); myPathfinder = GetComponent<AIFollow>(); my = GetComponent<npcCharacteristics>(); myAnimator = myBody.GetComponent<Animator>(); myBehaviour = GetComponent<Behaviour>(); myEnemySearch = GetComponent<EnemySearchProtocol>(); aggressivePlayer = GetComponent<EnemyAttack>(); // Получаем контроллер _controller = GetComponent<CharacterController>(); // Получаем компонент трансформации объекта, к которому привязан данный компонент myTransform = transform; // Получаем компонент трансформации игрока myEnemyTransform = GameObject.Find("GLOBAL").transform; myModel = transform.GetChild(0); //выключаем пасфайндер, чтобы не ходил пока Walk(false); }
void Start () { // initialize enemy's attribute enemy = GameObject.FindGameObjectWithTag("Enemy"); // find enemy gameobject int the scene enemyAttribute = enemy.GetComponent<Enemy> (); enemyScore = enemy.GetComponent<EnemyScore> (); enemyAttack = enemy.GetComponent<EnemyAttack> (); }
void Awake() { agent = GetComponent<NavMeshAgent>(); obstacle = GetComponent<NavMeshObstacle>(); m_Animation = GetComponentInChildren<Animation>(); enemyAttack = GetComponent<EnemyAttack>(); stats = GetComponent<UnitStats>(); m_AudioSource = GetComponent<AudioSource>(); baseAttackSpeedCache = timeBetweenAttacks; switch (unitType) { case EnemyTypes.Minion: selectedAction = "Punch"; break; case EnemyTypes.Brute: selectedAction = "Slam"; break; case EnemyTypes.Evoker: selectedAction = "Shoot"; break; case EnemyTypes.Bob: selectedAction = "Explode"; break; default: break; } }
public void levelUP(EnemyEnergy enemyEnergy, EnemyAttack enemyAttack) { // level up /* * if the score >= the score required to level up(lvlScore), the player will level up. * the lvlScore will be multiplied by 3 */ level++; scoreLevel *= 3; switch (level) { case 1: enemyEnergy.setMaxEnergy (110); enemyAttack.setAtk (2); break; case 2: enemyEnergy.setMaxEnergy (120); enemyAttack.setAtk (3); break; case 3: enemyEnergy.setMaxEnergy (130); enemyAttack.setAtk (4); break; case 4: enemyEnergy.setMaxEnergy (140); enemyAttack.setAtk (5); break; case 5: enemyEnergy.setMaxEnergy (150); enemyAttack.setAtk (6); break; } }
//knock enemy back void OnTriggerEnter2D(Collider2D Enemyhit){ Debug.Log("Knock the enemy back"); //GameObject thePlayer = GameObject.Find("Player"); enemyAttack = enemy.GetComponent<EnemyAttack>(); //playerStats = thePlayer.GetComponent<PlayerStats>(); //Hittime is to make sure the enemy on collision doesnt kill you by sticking and overlay //if the gameobject hit is a Enemy then take knockback and dmg if (Enemyhit.gameObject.tag == "Enemies") { //Deal dmg only per this amount of time (cool down) if (Hittime + 0.25f < Time.time) { Debug.Log("enemy knock back"); Hittime = Time.time; float verticalpush = Enemyhit.gameObject.transform.position.y - transform.position.y; float horizontalpush = Enemyhit.gameObject.transform.position.x - transform.position.x; //Check the target rigidbody and knock it back Debug.Log(enemy); enemy.GetComponent<Rigidbody2D>().AddForce(new Vector2(horizontalpush * 1500, verticalpush * 1500)); // this value has to change to base on character level //this is actually affecting the Health variable in HeroStat //Debug.Log (playerStats.curHealth); } } }
void Awake () { player = GameObject.FindGameObjectWithTag ("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); enemyAttack = GetComponent <EnemyAttack> (); nav = GetComponent <NavMeshAgent> (); }
// Use this for initialization void Start() //only execute once!!! { GameObject thePlayer = GameObject.Find("Player"); enemyAttack = enemy.GetComponent<EnemyAttack>(); playerStats = thePlayer.GetComponent<PlayerStats>(); //this part can update GUI or Sounds of HeartBeat (if any) }
void OnTriggerEnter2D(Collider2D other) { if (other.tag != "Player" && other.tag != "Collectibles" && other.tag != "LethalHazard" && other.tag != "Platform") { otherRB = other.GetComponent<Rigidbody2D> (); Debug.Log ("not here"); if (other.tag == "Destructable Platform") { Debug.Log ("here"); other.GetComponent<PlatformHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Enemy" && attTimer <= 0) { timer = 0.1f; other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Boss" && attTimer <= 0) { timer = 0.1f; if (sasuke != null) { sasuke.takeDamage(abilityDamage); } else { return; } } if (other.tag == "Boss") { other.GetComponent<BossHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Destroyable") { DestroyObject(other.gameObject); } if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(stunTime); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(stunTime); } if (other.transform.position.x < transform.position.x) { otherRB.velocity = new Vector2 (-10, 2); } else { otherRB.velocity = new Vector2 (10, 2); } } }
void Awake() { m_EnemyAttack = GetComponent<EnemyAttack>(); m_Animation = GetComponentInChildren<Animation>(); m_AudioSource = GetComponent<AudioSource>(); m_ParticleSystem = GetComponentInChildren<ParticleSystem>(); stats = GetComponent<UnitStats>(); pathNodeCollection = navPath.GetComponentsInChildren<PathNode>(); }
PlayerHealth playerHealth; //Reference to the players health #endregion Fields #region Methods void Awake() { //Setting up References player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent<PlayerHealth>(); enemyHealth = GetComponent<EnemyHealth>(); enemyattack = GetComponent<EnemyAttack>(); nav = GetComponent<NavMeshAgent>(); anim = GetComponent<Animation>(); }
// other methods public void isExhausted(EnemyAttack enemyAttack, Text energyGUI) { // is currently exhausted energy += 0.25f; if (energyPercent < 100) { energyGUI.color = Color.red; enemyAttack.setCanAttack (false); } else { energyGUI.color = Color.white; enemyAttack.setCanAttack (true); } }
void Awake() { enemySight = GetComponent<EnemySight>(); nav = GetComponent<NavMeshAgent>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent<LastPlayerSighting>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent<PlayerHealth>(); playerMovement = player.GetComponent<Char_Movement>(); anim = animObj.GetComponent<Animator>(); audio = GetComponent<AudioSource>(); enemAttack = transform.Find("SmackZone").gameObject.GetComponent<EnemyAttack>(); }
// Use this for initialization void Awake() { //anim = GetComponent<Animator>(); //to use with bullets // //boxCollider2D = GetComponent<BoxCollider2D>(); enemyMovement = GetComponent<EnemyMovement>(); enemyAttack = GetComponentInChildren<EnemyAttack>(); currentHealth = startingHealth; }
// Use this for initialization void Start () { colliderRadius = GetComponent<CapsuleCollider>().radius; rigidBody = GetComponent<Rigidbody>(); playerTransform = TheGame.get().player.transform; enemyAttack = GetComponent<EnemyAttack>(); //not null if enemy has ranged attack. enemyRanged = GetComponent<EnemyRanged>(); }
void OnTriggerEnter2D(Collider2D other) { if (timeBetweenAttacks <= 0 && (other.tag == "Enemy" || other.tag == "Boss")) { timeBetweenAttacks = 0.2f; Debug.Log("time reseted"); if (other.name != "Player" || other.tag != "Collectibles" || other.tag != "LethalHazard" || other.tag != "Platform") { if (other.GetComponent<Rigidbody2D> () == null) { return; } else { otherRB = other.GetComponent<Rigidbody2D> (); } if (other.tag == "Boss") { if (sasuke != null) { timer = 0; sasuke.takeDamage (1); } else { return; } } if (other.tag == "Destructable Platform") { other.GetComponent<PlatformHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "MysteryBox") { other.GetComponent<MysteryBoxHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Enemy") { Debug.Log("damage deal"); other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "MiniBoss") { other.GetComponent<BossHealthManager> ().takeDamage (abilityDamage); } if (other.GetComponent<EnemyMovement> ()) { eMScrp = other.GetComponent<EnemyMovement> (); eMScrp.GetStun (stunTime); } if (other.GetComponent<EnemyAttack> ()) { eAScrp = other.GetComponent<EnemyAttack> (); eAScrp.GetStun (stunTime); } if (other.transform.position.x < player.transform.position.x) { otherRB.velocity = new Vector2 (-5, 2); } else { otherRB.velocity = new Vector2 (5, 2); } } } //Cleanup //Destroy(gameObject); }
void Start() { target = GameObject.Find("Character").transform; animator = GetComponentInChildren<Animator> (); attack = GetComponent<EnemyAttack>(); enemy = GetComponent<Enemy>(); cliff = GetComponentInChildren<CliffDetection>(); if (cliff == null) Debug.Log("Cliff Detection not found"); }
void Awake () { anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> ();; enemyAttack = GetComponent <EnemyAttack> (); GetComponent <NavMeshAgent> ().enabled = true; GetComponent <Rigidbody> ().isKinematic = false; currentHealth = startingHealth; StartGrowing(); }
void Start() { enemy = GameObject.FindGameObjectWithTag ("Enemy"); enemyDeck = GameObject.FindGameObjectWithTag ("GameController").GetComponent<EnemyDeck> (); //enemyHand = enemyDeck.handEnemy; enemyAttack = enemy.GetComponent<EnemyAttack> (); enemyHealth = enemy.GetComponent<EnemyHealth> (); enemyMoney = enemy.GetComponent<EnemyMoney> (); EnemyOffensePanel = GameObject.FindGameObjectWithTag ("EnemyOffense"); EnemyDefensePanel = GameObject.FindGameObjectWithTag ("EnemyDefense"); }
void Awake() { // intialize enemy's attribute enemyScore = GetComponent<EnemyScore> (); enemyAttack = GetComponent<EnemyAttack> (); enemyEnergy = GetComponent<EnemyEnergy> (); enemyLevel = GetComponent<EnemyLevel> (); // other flag status facingLeft = true; // enemy start in the scene facing left grounded = false; doubleJump = false; source = GetComponent<AudioSource> (); }
// other methods public void isExhausted(EnemyAttack enemyAttack, Text energyGUI) // is currently exhausted { energy += 0.25f; if (energyPercent < 100) { energyGUI.color = Color.red; enemyAttack.setCanAttack(false); } else { energyGUI.color = Color.white; enemyAttack.setCanAttack(true); } }
// Start is called before the first frame update void Awake() { playerLayer = LayerMask.NameToLayer("Player"); ui = FindObjectOfType <InGameUIManager>(); // TODO make this change to be direction towards player on spawning direction = -1; seek = gameObject.AddComponent <GroundSeek>() as GroundSeek; seek.Initialize(this); attack = gameObject.AddComponent <SlideAttack>() as SlideAttack; attack.Initialize(this); SwitchState(State.SEEK); }
void OnEnable() { anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); rigidbody = GetComponent <Rigidbody> (); navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent> (); capsuleCollider = GetComponent <CapsuleCollider> (); sphereCollider = GetComponent <SphereCollider> (); enemyAttack = GetComponent <EnemyAttack> (); currentHealth = startingHealth; isDead = false; }
//Called by SlimeProjectile script public void AttachToEnemy(EnemyAttack enemy) { //Set the targetAttack variable to the provided enemy targetAttack = enemy; //Get a reference to the enemy's health targetHealth = targetAttack.GetComponent <EnemyHealth>(); //Tell the enemy about this debuff targetAttack.SlimeDebuff = this; //Nest this debuff to the enemy (so it follows the enemy around) transform.parent = targetAttack.transform; //Center this debuff on the enemy, except move it slightly up transform.localPosition = new Vector3(0f, 1f, 0f); //Start attacking the enemy StartCoroutine("AttackEnemy"); }
// Use this for initialization void Start() { Debug.Assert(_foreground != null, "Could not find reference to foreground"); Debug.Assert(_background != null, "Could not find reference to background"); Debug.Assert(_border != null, "Could not find reference to border"); // Try to find enemy if (transform.parent != null) { _character = transform.parent.GetComponent <Character>(); _enemy = transform.parent.GetComponent <EnemyAttack>(); } _foregroundStartSize = _foreground.GetComponent <RectTransform>().sizeDelta; }
void Awake() { // intialize enemy's attribute enemyScore = GetComponent <EnemyScore> (); enemyAttack = GetComponent <EnemyAttack> (); enemyEnergy = GetComponent <EnemyEnergy> (); enemyLevel = GetComponent <EnemyLevel> (); // other flag status facingLeft = true; // enemy start in the scene facing left grounded = false; doubleJump = false; source = GetComponent <AudioSource> (); }
private EnemyAttack ea; //EnemyAttack // Use this for initialization void Start() { //myNavにNavMeshAgentを取得させる myNav = GetComponent <NavMeshAgent>(); //myTargetにユニティちゃんの情報を代入 myTarget = GameObject.Find("unitychan"); //myAminにAnimatorを取得させる myAmin = GetComponent <Animator>(); //egにEnemycontrollerのEnemygeneratorを取得させる eg = GameObject.Find("Enemycontroller").GetComponent <Enemygenerator>(); //このオブジェクトのコライダーを機能させる GetComponent <CapsuleCollider>().enabled = true; //eaにこのオブジェクトに取得しているEnemyAttackを取得させる ea = this.gameObject.GetComponent <EnemyAttack>(); }
void Start() { EnemySprites = new Sprite[2]; EnemySprites[0] = Frame1; EnemySprites[1] = Frame2; Health = 10; Player = GameObject.FindWithTag("Player"); Agent = GetComponent <NavMeshAgent>(); enemyAtt = GetComponent <EnemyAttack>(); }
void Awake() { // Setting up the references. anim = GetComponent <Animator>(); enemyAudio = GetComponent <AudioSource>(); myAgent = GetComponent <NavAgentStateMachine_Best>(); enemyAttack = GetComponent <EnemyAttack>(); rb = GetComponent <Rigidbody>(); playerAttack = FindObjectOfType <PlayerAttack>(); // Setting the current health when the enemy first spawns. currentHealth = maxHealth; myUI = Instantiate(enemyHealthUI); }
void Start() { if (GetComponent<EnemyMovement> ()) { if (GetComponent<EnemyAnimation> () != null) { enemyAnimation = FindObjectOfType<EnemyAnimation> (); enemyDefeatedAnimDuration = enemyAnimation.enemyDefeatedAnimDuration; } else { enemyAnimation = null; } //Auto Hook if (GetComponent<EnemyHealthManager> ()) { enemyHealthManager = GetComponent<EnemyHealthManager> (); } //else { // enemyHealthManager = GetComponentInChildren<EnemyHealthManager> (); //} // Adding "In Chidren" fixes errors, but generates whorst ones. Its probably necesary though. enemyAttack = GetComponent<EnemyAttack> (); enemyMovement = GetComponent<EnemyMovement> (); enemyAnimator = GetComponent<Animator> (); //Initial Save startingPosition = gameObject.transform.position; startingHP = enemyHealthManager.enemyHP; } else { if (GetComponentInChildren<EnemyAnimation> () != null) { enemyAnimation = FindObjectOfType<EnemyAnimation> (); enemyDefeatedAnimDuration = enemyAnimation.enemyDefeatedAnimDuration; } else { enemyAnimation = null; } //Auto Hook if (GetComponentInChildren<EnemyHealthManager> ()) { enemyHealthManager = GetComponentInChildren<EnemyHealthManager> (); } //else { // enemyHealthManager = GetComponentInChildren<EnemyHealthManager> (); //} // Adding "In Chidren" fixes errors, but generates whorst ones. Its probably necesary though. enemyAttack = GetComponentInChildren<EnemyAttack> (); enemyMovement = GetComponentInChildren<EnemyMovement> (); enemyAnimator = GetComponentInChildren<Animator> (); //Initial Save startingPosition = gameObject.transform.position; startingHP = enemyHealthManager.enemyHP; } }
void enemyAttack() { if (isGame) { //gameData.Enemy.Attacks[rn.Next(0, gameData.Enemy.Attacks.Count() - 1)]; EnemyAttack enemyAttack = null; foreach (EnemyAttack value in RandomValues(gameData.Enemy.Attacks)) { enemyAttack = value; } int damage = 0; if (enemyAttack != null) { damage = enemyAttack.Damage(gameData.Player, gameData.Enemy); } gameData.Player.HP = gameData.Player.HP - damage; if (damage > 0) { foreach (CriticalEffect criticalEffect in enemyAttack.CriticalEffects) { if (criticalEffect.isEffect()) { if (!gameData.PlayerCriticalEffects.Contains(criticalEffect)) { gameData.PlayerCriticalEffects.Add(criticalEffect); } } } } enemyAttackInfo(damage, enemyAttack.Name); updateStats(); enemyAttackAnim(enemyAttack.Anim); if (damage != 0) { hurtAnim(); } timerEnemyAttack.Stop(); } }
static WaitForSeconds updateDelay = new WaitForSeconds(.5f); //delay before checking the player position again // Use this for initialization void Start() { isPursuing = false; isWalking = false; walkWait = new WaitForSeconds(10); navAgent = GetComponent <NavMeshAgent>(); animController = GetComponent <Animator>(); StartCoroutine(getRandomDestination()); aggroRange = GetComponent <SphereCollider>(); m_enemyAttack = GetComponent <EnemyAttack>(); aggroRange.radius = aggroRadio; walkSpeed = navAgent.speed; walkAngularSpeed = navAgent.angularSpeed; }
void CollidedWithEnemy(EnemyAttack enemy) { enemy.Attack(this); if (health <= 0) { if (enemy.tag == "Dog") { PlayerDeadDog(); } else { PlayerDeadMan(); } Invoke("Respawn", 3); } }
protected override IEnumerator Play() { while (!isDie) { if (isSolidersCompelete()) { EnemyAttack <State> p = (EnemyAttack <State>)pattern.Dequeue(); state = p.Name; yield return(new WaitForSeconds(p.Value[0])); Order(p.Value[1], p.Value[2], p.Value[3]); pattern.Enqueue(p); } yield return(new WaitForSeconds(0.2f)); } }
public AI(EnemyInformation enemyInformation, GameObject enem, List <Ability> abs, EnemyMovement movemen) { player = GameObject.FindWithTag("Player"); enemyInfo = enemyInformation; enemy = enem; abilities = abs; movement = movemen; anim = enemy.GetComponent <Animator>(); attack = new EnemyAttack(enem); inCombat = false; canAttack = false; checkRate = .6f; timeStamp = Time.time + checkRate; state = AIState.IDLE; }
public void ScheduleEnemyAttack(EnemyAttack attack_to_schedule) { enemy_moster.phase_element_bonuses[(int)attack_to_schedule.element] += bonus_value_for_next; bonus_value_for_next = Mathf.CeilToInt((float)enemy_moster.GetEffectiveAffinity(attack_to_schedule.element) * enemy_moster.phase_increment_bonus_ratio); attack_to_schedule = enemy_moster.GetAttack(attack_to_schedule.element, attack_to_schedule.is_burst); TimelineEvent timeline_event_to_schedule; timeline_event_to_schedule = new TimelineEvent(); timeline_event_to_schedule.side = TimelineSide.ENEMY; timeline_event_to_schedule.event_type = attack_to_schedule.is_burst ? TimelineEventType.ENEMY_BURST_ATTACK : TimelineEventType.ENEMY_SIMPLE_ATTACK; timeline_event_to_schedule.element = attack_to_schedule.element; timeline_event_to_schedule.name = attack_to_schedule.damage.ToString(); timeline_event_to_schedule.time_remaining = EventsTimeline.instance.total_time; timeline_event_to_schedule.on_complete_routine = Coroutine_EnemyAttackEffects(attack_to_schedule); EventsTimeline.instance.Schedule(timeline_event_to_schedule); }
public virtual void Attack() { var newProjectile = Instantiate(_queuedAttack._attackPrefab, transform.position + transform.forward, Quaternion.identity).GetComponent <ProjectileAttack>(); newProjectile.Initialise(_queuedAttack, _redirectionManager.headTransform, _currentPhase._speedMultiplier); _animatedInterface._audioSource.PlayOneShot(_queuedAttack._spawnAudio, _queuedAttack._spawnAudioScale); _queuedAttack = null; _attackObjects.Add(newProjectile.gameObject); if (_currentPhase._containsMovement) { _animatedInterface.RotateAroundPivot(Random.Range(-180f, 180f), _redirectionManager.headTransform.position); } _animatedInterface.AnimationTrigger("Idle"); }
public SkeletonArcher(string enemyType, int level) : base(enemyType, level) { CurrentHealth = level * level * 10; MaxHealth = level * level * 10; Damage = 1.8; MaxDamage = Damage; AttackRate = 7.0f; MaxAttackRate = AttackRate; rateOffset = 2.0f; CriticalPercentage = 8; MissPercentage = 15; Defense = 100; MaxDefense = Defense; attacks = new EnemyAttack[1]; attacks [0] = new EnemyAttack(); }
// Start is called before the first frame update void Awake() { //If any of the required components are missing, try to find them if (!health) { health = GetComponent <EnemyHealth>(); } if (!movement) { movement = GetComponent <EnemyMovement>(); } if (!attack) { attack = GetComponent <EnemyAttack>(); } }
void Awake() { node1 = path.nodes[0]; node2 = path.nodes[1]; transform.position = node1.position; targetNode = node2; anim = GetComponent <Animator>(); health = GetComponent <EnemyHealth>(); enemyAttack = GetComponentInChildren <EnemyAttack>(); enemyAttack.gameObject.SetActive(false); canMove = true; AddListeners(); }
void Start() { rigidBody = GetComponent <Rigidbody>(); attack = GetComponent <EnemyAttack>(); myTransform = transform; initialPos = myTransform.position; moveStep = speed * Time.deltaTime; rotStep = rotationSpeed * Time.deltaTime; if (!player) { player = GameObject.FindWithTag("Player").transform; } if (player) { playerCollider = player.GetComponent <CapsuleCollider>(); } }
void Awake() { barrel = transform.Find("Barrel"); barrelEnd = barrel.transform.Find("Visual"); firingDistRef = barrel.transform.Find("EndRef"); firingDistRef.position += (Vector3.left * seekRange); playerPos = GameObject.FindGameObjectWithTag("Player").transform; playerLayer = LayerMask.NameToLayer("Player"); ui = FindObjectOfType <InGameUIManager>(); seek = gameObject.AddComponent <TurretSeek>() as TurretSeek; seek.Initialize(this); attack = gameObject.AddComponent <BaseballAttack>() as BaseballAttack; attack.Initialize(this); SwitchState(State.SEEK); }
private void addSkills28() { Func <Enemy> getTarget = () => GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)]; skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(3, 2), EnemyBuffs.DMG_REFLECT, getTarget, 1, skillTrans)); EnemyBoardSkill decEight = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3), (Orb o) => o.getOrbValue() == ORB_VALUE.EIGHT, 0.1f, skillTrans); decEight.addIncSkill(0.1f, (Orb o) => - 3); skillList.Add(decEight); EnemyTimer DOT8 = EnemyTimer.Create(() => GameController.Instance.isTurnMod(3, 1), 1f, 1, skillTrans); DOT8.addDOTSkill(() => - 8); skillList.Add(DOT8); skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 2), false, () => Player.Instance.gameObject, () => - currState.damage, skillTrans)); }
private void addSkills27() { Func <Enemy> getTarget = () => GameController.Instance.getCurrEnemies()[RNG.Next(GameController.Instance.getCurrEnemies().Count)]; skillList.Add(EnemyHPBuff.Create(() => GameController.Instance.isTurnMod(3, 1), EnemyBuffs.DMG_MITI_50, getTarget, 1, skillTrans)); EnemyBoardSkill decSeven = EnemyBoardSkill.MarkIfSkill(() => GameController.Instance.isTurnMod(3, 2), (Orb o) => o.getOrbValue() == ORB_VALUE.SEVEN, 0.1f, skillTrans); decSeven.addIncSkill(0.1f, (Orb o) => - 2); skillList.Add(decSeven); EnemyTimer DOT7 = EnemyTimer.Create(() => GameController.Instance.isTurnMod(3), 1f, 1, skillTrans); DOT7.addDOTSkill(() => - 7); skillList.Add(DOT7); skillList.Add(EnemyAttack.Create(() => GameController.Instance.isTurnMod(3, 1), false, () => Player.Instance.gameObject, () => - currState.damage, skillTrans)); }
//Kill all the enemy in the scene public override void Activate () { playerSkill.decreaseBar (skillCost); enemy = GameObject.FindGameObjectsWithTag ("Enemy"); int[] previousDamage = new int[enemy.Length]; //For unit testing for (int i = 0; i < enemy.Length; i++) { float yPositionOffset = enemy[i].transform.position.y - player.transform.position.y; if (yPositionOffset > 1 || yPositionOffset < -1) { //We heal the enemy on the opposition bridge enemyAttack = enemy[i].GetComponent<EnemyAttack>(); previousDamage[i] = enemyAttack.attackDamage; enemyAttack.attackDamage += increasedAmount; } } Debug.Log ("Enemy Attack Increased"); IncreaseEnemyAttackTest (previousDamage); }
public void Setup() { PMove = Instance.GetComponent <PlayerMovement> (); PAttack = Instance.GetComponent <PlayerAttack> (); EMove = Instance.GetComponent <EnemyMovement> (); EAttack = Instance.GetComponent <EnemyAttack> (); CanvasGameObject = Instance.GetComponentInChildren <Canvas> ().gameObject; ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(PlayerColor) + ">TANK " + "</color>"; MeshRenderer[] renderers = Instance.GetComponentsInChildren <MeshRenderer> (); for (int i = 0; i < renderers.Length; i++) { renderers[i].material.color = PlayerColor; } }
//ForDamege void OnTriggerEnter2D(Collider2D obj) { if (obj.tag == EnemyAttackTag) { EnemyAttack ea = obj.GetComponent <EnemyAttack>(); Debug.Log("hit" + ea.Damage); InvincibleFlg = true; StartCoroutine(this.DelayMethod(InvincibleTime, () => { InvincibleFlg = false; })); if (health.health <= 0) { GameOver(); } } }
private void Start() { GameObject attackRadius = gameObject.transform.Find("AttackRadius").gameObject; refScript = attackRadius.GetComponent <EnemyAttack>(); animator = GetComponentInChildren <Animator>(); SetupFlash(); SetupLoot(); // Make sure player exists (finished loading) before running these player = GameObject.FindGameObjectWithTag("Player").transform; cam = player.GetComponentInChildren <Camera>(); SetupHpBar(); SetupUI(Instantiate(enemyAlert_prefab)); audioSourceAttack.clip = alertSound; audioSourceAttack.Play(); }
private void Shoot() { agent.isStopped = true; anim.Walk(false); Ray shootRay = new Ray(firePoint.position, firePoint.forward); RaycastHit infoHit; agent.transform.LookAt(targetPos.position); Debug.DrawRay(firePoint.position, firePoint.forward * 100f, Color.blue, 2f); currentShootTimer += Time.deltaTime; float randomFireRate = Random.Range(2f, 4f); if (currentShootTimer > randomFireRate + 1) { currentShootTimer = 0f; Invoke("PlayShootAnim", 0.3f); var plasmaMuzzle = Instantiate(muzzleEffect, muzzlePoint.position, Quaternion.identity); if (Physics.Raycast(shootRay, out infoHit, 100f)) { //Debug.Log("Enemy Shot " + infoHit.collider.name); if (infoHit.collider.gameObject.CompareTag(Tags.PLAYER)) { UniversalHealthController enemyhealth = infoHit.collider.gameObject.GetComponent <UniversalHealthController>(); if (enemyhealth != null) { enemyhealth.ApplyDamage(shootDamage); } } } } if (Vector3.Distance(transform.position, targetPos.position) > shootRadius) { enemyAttack = EnemyAttack.CHASE; } }
private void Start() { startingPosition = transform.position; GameObject attackRadius = gameObject.transform.Find("AttackRadius").gameObject; refScript = attackRadius.GetComponent <EnemyAttack>(); animator = GetComponentInChildren <Animator>(); timer = wanderTimer; goingBackToStartTimer = 0; SetupFlash(); SetupLoot(); // Make sure player exists (finished loading) before running these player = GameObject.FindGameObjectWithTag("Player").transform; cam = player.GetComponentInChildren <Camera>(); SetupHpBar(); }
private float attackTimer; //攻击计时器 void Start() { animID = new Dictionary <string, int>(); player = GameObject.FindGameObjectWithTag("Player"); anim = GetComponent <Animator>(); nav = GetComponent <NavMeshAgent>(); if (player) { playerInfoScript = player.GetComponent <PlayerInfo>(); } info = GetComponent <EnemyInfo>(); attackScript = GetComponent <EnemyAttack>(); //保存初始位置信息 initialPosition = transform.position; //生成时给赋值游走的坐标点(前后左右四个点) wanderPositions = new Vector3[4]; wanderPositions[0] = new Vector3(initialPosition.x + wanderRadius / 2 + Random.Range(0, 5.0f), initialPosition.y, initialPosition.z); wanderPositions[1] = new Vector3(initialPosition.x + wanderRadius / 2 - Random.Range(0, 5.0f), initialPosition.y, initialPosition.z); wanderPositions[2] = new Vector3(initialPosition.x, initialPosition.y, initialPosition.z + wanderRadius / 2 + Random.Range(0, 5.0f)); wanderPositions[3] = new Vector3(initialPosition.x, initialPosition.y, initialPosition.z + wanderRadius / 2 - Random.Range(0, 5.0f)); attackDistance = info.attackDistance; nav.stoppingDistance = attackDistance - 0.2f; //分配动画ID animID.Add("Idle", 0); animID.Add("Walk", 1); animID.Add("Run", 2); animID.Add("Warn", 3); animID.Add("Attack", 4); animID.Add("Wound", 5); //给每一个怪物配置死亡掉落的经验和金币 info.golden = Random.Range(50, 70); info.exp = Random.Range(60, 75); //应当检测一下长度做保护··· //随机一个待机动作 RandomAction(); }
void OnTriggerEnter2D(Collider2D other) { //if (other.name != "Player" || other.tag != "Collectibles" || other.tag != "LethalHazard" || other.tag != "Platform") if(other.GetComponent<Rigidbody2D> () || other.tag == "Obstacle") { otherRB = other.GetComponent<Rigidbody2D> (); if (other.tag == "Boss" && attTimer <=0) { attTimer = 0.1f; sasuke.takeDamage (abilityDamage); } if (other.tag == "Enemy" && attTimer <=0) { attTimer = 0.1f; other.GetComponent<EnemyHealthManager> ().takeDamage (abilityDamage); } if (other.tag == "Obstacle") { //Debug.Log("IS GETTING CALLED"); DestroyObject(other.gameObject); } if(other.GetComponent<EnemyMovement>()) { eMScrp = other.GetComponent<EnemyMovement>(); eMScrp.GetStun(stunTime); } if( other.GetComponent<EnemyAttack>()) { eAScrp = other.GetComponent<EnemyAttack>(); eAScrp.GetStun(stunTime); } if(other.tag != "Obstacle"){ if (other.transform.position.x < transform.position.x) { otherRB.velocity = new Vector2 (-18, 2); } else { otherRB.velocity = new Vector2 (18, 2); } } } }
// Update is called once per frame void Update() { objectTarget = GameObject.FindGameObjectWithTag("Player"); if(objectTarget.name == "FirstPersonFab(Clone)"|| objectTarget.name == "FirstPersonFab"){ found = true; } else{ return; } if(found == true){ target = objectTarget.transform; at = GetComponent<EnemyAttack>(); float distance = Vector3.Distance(transform.position,target.transform.position); if (distance <= ShootRange * 2) isFollow = true; isAttack = false; if (distance <= ShootRange) { isFollow = false; isAttack = true; } if (isFollow == true){ Follow(); } if (isAttack == true){ at.Attack(isAttack); //transform.position = targetpos; Transform x = transform; x.LookAt(target.position); Speed = 1; } } }
void Awake() { currentHealth = startingHealth; attackTimer = 0f; poiTimer = 0f; turnTimer = 0f; destinationReached = false; alerted = false; playerInRange = false; damageTaken = false; direction = FacingDirection.Front; player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent<Player>(); detection = player.GetComponentInChildren<PlayerDetection>(); enemyRigidbody = GetComponent<Rigidbody2D>(); if (ranged) attackScript = GetComponentInChildren<EnemyShooting>(); else attackScript = GetComponentInChildren<EnemyMelee>(); attackRangeCollider = attackScript.gameObject.GetComponent<CircleCollider2D>(); attackRangeCollider.radius = attackScript.GetRange(); anim = GetComponent<Animator>(); points = new List<PointOfInterest>(); }
void Start() { enemyAttack = this.GetComponent<EnemyAttack>(); spawnLocation = transform.position; spawnDirection = actorMovement.Direction; }
void Start() { enemyAttack = transform.parent.GetComponent<EnemyAttack>(); actorMovement = transform.parent.GetComponent<ActorMovement>(); }
void Start() { movement = GetComponent<EnemyMovement>(); AI = GetComponent<EnemyAttack>(); if(gameObject.name == "Sasuke") { sasuke = FindObjectOfType<SasukeController>(); } else { health = GetComponent<EnemyHealthManager>(); hp = health.enemyHP; } rb2D = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); moveSpeed = movement.speed; }
void Awake() { curHP = startHP; enemyAttack = GetComponent<EnemyAttack> (); }
void Awake() { node1 = path.nodes[0]; node2 = path.nodes[1]; transform.position = node1.position; targetNode = node2; anim = GetComponent<Animator>(); health = GetComponent<EnemyHealth>(); enemyAttack = GetComponentInChildren<EnemyAttack>(); enemyAttack.gameObject.SetActive(false); canMove = true; AddListeners(); }
// Use this for initialization void Start() { e = transform.parent.gameObject.GetComponent<EnemyAttack>(); }