void Start() { if (main == null) { main = transform.parent.GetComponent <BossStateManager>(); } }
void OnCollisionEnter2D(Collision2D other) { if ((_onHit != 2) && (other.collider.name == "BS_Boss") && (!_isInvincible)) { if (!_isDead) { GenEffect(Get_Angle_byPosition(this.transform.position, other.collider.GetComponent <Transform>().position), 25f, 2f, 10); OnDamage(); } } if ((_onHit == 2) && (other.collider.name == "BS_Boss")) { GenEffect(Get_Angle_byPosition(other.collider.GetComponent <Transform>().position, this.transform.position) + 60f, 30f, 3f, 8); GenEffect(Get_Angle_byPosition(other.collider.GetComponent <Transform>().position, this.transform.position) - 60f, 30f, 3f, 8); BossBehavior bossScript = other.collider.GetComponent <BossBehavior>(); bossScript.OnDamaged(Math_Boss_Damage()); _attackSuccess = true; _animController.AttackSuccess(); } if (other.collider.tag != "Wall") { TimerAttackReset(); } }
void DrawShoot(int index, int dmg) { StartCoroutine(ShotEffect(index)); Vector3 realDirection = fpsCam.transform.forward; Vector3 shootDirection = realDirection + new Vector3( Random.Range(-0.05f * index, 0.05f * index), Random.Range(-0.05f * index, 0.05f * index), Random.Range(-0.05f * index, 0.05f * index) ); Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(.5f, .5f, 0)); RaycastHit hit; linesRenderer[index].SetPosition(0, gunEnd.position); if (Physics.Raycast(rayOrigin, shootDirection, out hit, weaponRange)) { linesRenderer[index].SetPosition(1, hit.point); Shootable shootableComponent = hit.collider.GetComponent <Shootable>(); if (shootableComponent != null) { shootableComponent.Damage(dmg); } BossBehavior boosBehavior = hit.collider.GetComponent <BossBehavior>(); if (boosBehavior != null) { boosBehavior.ReceiveDamage(dmg); } } else { linesRenderer[index].SetPosition(1, rayOrigin + (shootDirection * weaponRange)); } }
// Constructor - Assume that Boss and Player are at Starting Positions. public BlackBoard() { // Transforms BossTransform = null; PlyrTransform = null; // Health PlyrHP = 1.0f; BossHP = 1.0f; //Current Active Specialist ActSpec = ActionSpecialists.AttackSpec; PasSpec = PassiveSpecialists.DistanceSpec; //Boss Variables BossBhvr = BossBehavior.Agressive; // Distance Variables CurBossLoc = BossLocation.RightSide; PlyrLoc = PlayerLocation.LeftFromBoss; DestBossLoc = BossLocation.RightSide; PlyrDist = PlayerDistance.Far; isMovingToOtherSide = false; isAtSafeDistance = false; isPlyrLinedUp = false; // Projectile Variables AreBulletsNear = false; NumberBulletsNear = 0; }
public virtual void Setup(BossBehavior myBehavior) { _myBehavior = myBehavior; _myTransform = myBehavior.transform; _elapsedTime = 0; _startingPoint = _myTransform.position; }
public void Start() { _myNavMeshAgent = GetComponent<NavMeshAgent>(); AttackTarget = GameObject.Find("Player").transform; fountainPosition = GameObject.Find("Fountain").transform.position; minDistanceToTarget = 2f; maxDistanceToTarget = 80f; baseAttackChance = 25f; attackCool = false; _BossDetectionScript = gameObject.GetComponent<DarkGodStateMachine>(); _bossBehaviorScript = gameObject.GetComponent<BossBehavior>(); if(Path == null) { Debug.LogError("Path cannot be null.", gameObject); return; } currentPoint = Path.GetPathEnumerator(); currentPoint.MoveNext(); if(currentPoint.Current == null) return; transform.position = currentPoint.Current.position; _lastTransform = transform.position; }
// Use this for initialization void Awake() { LeftDead = false; RightDead = false; BossL = transform.GetChild (0).gameObject.GetComponent<BossBehavior>(); BossR = transform.GetChild (1).gameObject.GetComponent<BossBehavior>(); StartCoroutine ("MoveToCenter"); }
public override void Setup(BossBehavior myBehavior) { base.Setup(myBehavior); _maxChargeSize = _beamObjects[0]._chargeBall.transform.localScale; ChangeState(BeamAttackState.Tracking); _defaultRotation = _beamObjects[0]._beamParent.transform.eulerAngles.z; _beamVolleysFired = 0; }
public override void Setup(BossBehavior myBehavior) { base.Setup(myBehavior); float speed = _myBehavior.onPhaseTwo ? _moveSpeedPhaseTwo : _moveSpeed; _timeToMove = Vector3.Distance(_startingPoint, _movementEndPoint) / speed; _timeBetweenVolleys = _timeToMove / (_numberOfVolleys + 1); _nextVolleyTime = _timeBetweenVolleys; _volleysFired = 0; }
public override void Setup(BossBehavior myBehavior) { base.Setup(myBehavior); float xPosition = CameraManager.GetCameraBounds().max.x + _distanceAppearOffCamera; float yPosition = _movementEndPoint.y; _startingPoint = new Vector3(xPosition, yPosition); _myTransform.position = _startingPoint; _timeToMove = Vector3.Distance(_startingPoint, _movementEndPoint) / _moveSpeed; }
void Start() { if (!isBoss) { enemy = GetComponentInParent <EnemyBehavior>(); } else { boss = GetComponentInParent <BossBehavior>(); } }
private void OnTriggerEnter2D(Collider2D hitInfo) { BossBehavior boss = hitInfo.GetComponent <BossBehavior>(); Enemy_behavior enemy = hitInfo.GetComponent <Enemy_behavior>(); if (enemy != null) { enemy.TakeDamage(damage); } else if (boss != null) { boss.TakeDamage(damage); } Destroy(gameObject); }
void Start() { gameOver = false; bossCount = 1; restart = false; mainMenu = false; restartText.text = ""; gameOverText.text = ""; mainMenuText.text = ""; signInMenu.SetActive(false); score = 0; UpdateScore(); StartCoroutine(SpawnWaves()); script = bossPrefab.GetComponent <BossBehavior>(); }
private void OnTriggerEnter2D(Collider2D collision) { GameObject go = collision.gameObject; EnnemyState es = go.GetComponent <EnnemyState>(); if (es && !collision.isTrigger) { var Dir = GetComponentInParent <PlayerState>().IsFacingRight ? 1 : -1; es.OnDamage(Damage, Dir * Knockback); } BossBehavior bb = go.GetComponent <BossBehavior>(); if (bb && !collision.isTrigger) { bb.OnDamage(Damage); } }
void Start() { _pawn = this.GetComponent <BossBehavior>(); }
public override void Setup(BossBehavior myBehavior) { base.Setup(myBehavior); missilesFired = 0; FireMissiles(); }
public void SubscribeBoss(BossBehavior bossBehaviorParam) { bossBehavior = bossBehaviorParam; }
// Use this for initialization public void Init(MusicManager musicManager) { bossBehavior = boss.GetComponent <BossBehavior>(); bossBehavior.Init(musicManager); }
void Start() { _myAnimator = GetComponent<Animator>(); _myNavMeshAgent = GetComponent<NavMeshAgent>(); _player = GameObject.Find("Player").transform; _searchPath = new NavMeshPath (); _bossBehaviorScript = gameObject.GetComponentInParent<BossBehavior>(); _fountainPosition = GameObject.Find("Fountain").transform.position; if(MyZone != null) { _interestAreas = MyZone.GetComponentsInChildren<SphereCollider>(); } totalBossAdds = GameObject.FindGameObjectsWithTag("BossAdd").Length; }
// Ai movement private void Awake() { player = GameObject.Find("Player").transform; agent = GetComponent <NavMeshAgent>(); inst = this; }
private void Awake() { possibleBoss = FindObjectOfType <BossBehavior>(); Portals.AddPortal(location, this); }
void OnTriggerEnter2D(Collider2D other) { string t = other.GetComponent <Collider2D>().tag; //if bullet hits enemy, it bursts and damages enemy if (t == "Enemy") { Enemy e = other.GetComponent <Enemy>(); switch (myColor) { case PaintballBehavior.ColorMode.RED: if (Global.percentChance(20)) { e.triggerBuff(Enemy.BuffMode.burn); } break; case PaintballBehavior.ColorMode.BLUE: if (Global.percentChance(20)) { e.triggerBuff(Enemy.BuffMode.freeze); } break; case PaintballBehavior.ColorMode.YELLOW: break; default: break; } e.damage(damage, gameObject.GetComponent <SpriteRenderer>().color); Destroy(gameObject); } else if (t == "Boss") { BossBehavior b = other.transform.parent.GetComponent <BossBehavior>(); switch (myColor) { case PaintballBehavior.ColorMode.RED: if (Global.percentChance(10)) { b.triggerBuff(Enemy.BuffMode.burn); } break; case PaintballBehavior.ColorMode.BLUE: if (Global.percentChance(10)) { b.triggerBuff(Enemy.BuffMode.freeze); } break; case PaintballBehavior.ColorMode.YELLOW: break; default: break; } b.damage(damage, gameObject.GetComponent <SpriteRenderer>().color); Destroy(gameObject); } }