public Enemy getBoss() { EnemyTurnData enemyTurnData = new EnemyTurnData(); Card increaseStrengthCard = new Card(new CardData(), new CardActions()); // StatusData increaseStrengthData = new StatusData(StatusData.StatusEnum.vulnerable); // increaseStrengthData.name = "Vulnerable"; // increaseStrengthData.statusCount = 1; // increaseStrengthCard.data.statuses.Add(new Status(increaseStrengthData, new StatusActions())); // increaseStrengthCard.data.isEnemycard = true; // increaseStrengthCard.data.description = "Increase enemy strength by " + increaseStrengthData.statusCount; // enemyTurnData.baseEnemyTurns.Add(addCardToDeckTurn(increaseStrengthCard)); EnemyData data = new EnemyData(new HealthBarData(85), enemyTurnData); for (int i = 1; i < 4; i++) { CardData cardData = new CardData(3, 0); Card turn = new Card(cardData, new CardActions()); cardData.attackMultiplier = 2 + i; enemyTurnData.baseEnemyTurns.Add(turn); } EnemyActions enemyActions = new EnemyActions(); // bossEnemy.animatorController = Resources.Load<RuntimeAnimatorController>(spritePath + "MaskManController"); Enemy enemy = new Enemy(data, enemyActions); return(enemy); }
public virtual void UpdateMoveHandToHand() { //Debug.Log("UpdateMoveHandToHand"); //Debug.Log("CloseCombat: " + CloseCombat); if (Grounded) { if (CloseCombat || !CanMove && NavMeshAgent != null) { CurrentAction = EnemyActions.Idle; if (NavMeshAgent.isActiveAndEnabled) { NavMeshAgent.Stop(); } Rigidbody.velocity = Vector3.zero; if (CanAttack) { StartCoroutine(Attack()); } } else { if (CharAnimator != null) { CharAnimator.SetFloat("speed", 1); } if (NavMeshAgent != null && NavMeshAgent.isActiveAndEnabled && NavMeshAgent.isOnNavMesh) { NavMeshAgent.SetDestination(MyCharacterController.Instance.transform.position); } } } }
protected virtual void Awake() { navi = GetComponent <NavMeshAgent2D>(); player = GameObject.FindGameObjectWithTag("Player"); stopMovement = false; patrolPositions.Add(transform.position); actions = new EnemyActions(player, gameObject); baseSpeed = GetComponent <NavMeshAgent2D>().speed; weaknessMultiplier = 2; electricEffect = gameObject.transform.Find("ElectricEffect").gameObject.GetComponent <ParticleSystem>(); fireEffect = gameObject.transform.Find("FireEffect").gameObject.GetComponent <ParticleSystem>(); freezeEffect = gameObject.transform.Find("FrostEffect").gameObject.GetComponent <ParticleSystem>(); electricEffectEm = electricEffect.emission; electricEffectEm.enabled = false; fireEffectEm = fireEffect.emission; fireEffectEm.enabled = false; freezeEffectEm = freezeEffect.emission; freezeEffectEm.enabled = false; }
// Use this for initialization void Start() { GetEnemyMovementCtrl = GetComponent <EnemyMovementController>(); SetDirector(GetComponentInParent <GroupDirector>()); playerT = GameObject.FindGameObjectWithTag("Player").transform; myAction = EnemyActions.None; }
private void Awake() { enemyStatistics = GetComponent <EnemyStatistics>(); enemyMovement = GetComponent <EnemyMovement>(); enemyActions = GetComponent <EnemyActions>(); brain = GameObject.FindGameObjectWithTag(Tags.Brain); }
public virtual IEnumerator Idle(float time) { CharAnimator.SetFloat("speed", 0); CurrentAction = EnemyActions.Idle; yield return(new WaitForSeconds(time)); RandomAction(); }
void DefMagicButtonAction() { Debug.Log("Def magic release!"); PlayerActions action; action = GameObject.FindWithTag("Player").GetComponent <PlayerActions>(); action.defMagMethod(); }
void GiveUpButtonAction() { PlayerActions action; // attackFlag = true;//animator action = GameObject.FindWithTag("Player").GetComponent <PlayerActions>(); action.giveUpMethod(); }
void OnTriggerEnter(Collider other) { EnemyActions enAction = GetComponent <EnemyActions>(); if (other.gameObject.tag == "Hit" && /*!enAction.isStunned &&*/ !isHit) { isHit = true; WeaponManage(); } }
public void Stop() { EnemyActions enemy = numbersController.GetLast(); if (enemy != null) { enemy.DestroyEnemy(); } isRunning = false; }
protected override void Awake() { base.Awake(); model = transform.GetChild(0); //color = AssignColor(); enemyActions = GetComponent<EnemyActions>(); enemyMovement = GetComponent<EnemyMovement>(); levelManager = FindObjectOfType<LevelManager>(); }
private async Task SetEnemyActionsAsync() { var baseUri = _navigationManager.BaseUri; var data = await _http.GetStringAsync($"{baseUri}enemy-actions/enemy-actions.json"); EnemyActions = JsonSerializer.Deserialize <List <EnemyActions> >(data); Actions = EnemyActions.SelectMany(ea => ea.Actions) .GroupBy(ac => ac.Name, ac => ac.Description) .ToDictionary(ac => ac.Key, ac => ac.First()); }
public override void OnEnter() { var go = Fsm.GetOwnerDefaultTarget(gameObject); theScript = go.GetComponent <EnemyActions>(); if (!everyFrame.Value) { DoTheMethod(); Finish(); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { Player p = collision.gameObject.GetComponent <Player>(); p.HandleHit(); } else if (collision.gameObject.tag == "Enemy") { EnemyActions ea = collision.gameObject.GetComponent <EnemyActions>(); ea.Kill(); } Destroy(gameObject); }
private void Start() { if (transform.gameObject.name == "Player") { pActions = GetComponent <PlayerActions>(); pMovement = GetComponent <PlayerMovement>(); return; } else { eActions = GetComponent <EnemyActions>(); eMovement = GetComponent <EnemyMovement>(); } }
protected override void Awake() { base.Awake(); baddieType = EnemyConstants.EnemyTypes.Boss; damage = 20; health = 5000; maxHealth = 5000; chaseTimer = 0; shuffleTimer = 0; spawnTimer = 0; state = BossStates.Chase; GetComponent <SpriteRenderer>().color = new Color(.85f, .185f, .194f); actions = new EnemyActions(player, gameObject); actions.SetDetectionDistance(50); }
void Start() { if (agent == null) { agent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); } target = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player"); actions = GetComponent <EnemyActions>(); zombieHealthController = GetComponent <HealthController>(); enemyRb = GetComponent <Rigidbody>(); currentState = States.Idle; gameManager = GameObject.Find("Game Manager").GetComponent <GameManager>(); }
// Start is called before the first frame update void Start() { SpriteRenderer fieldGraphic = field.GetComponent <SpriteRenderer>(); for (int i = 0; i < enemyCount; ++i) { float x = Random.Range(fieldGraphic.transform.position.x - fieldGraphic.size.x / 2.0f, fieldGraphic.transform.position.x + fieldGraphic.size.x / 2.0f); float y = Random.Range(fieldGraphic.transform.position.y - fieldGraphic.size.y / 2.0f, fieldGraphic.transform.position.y + fieldGraphic.size.y / 2.0f); GameObject newEnemy = Instantiate(enemy, new Vector3(x, y, 0), Quaternion.identity); EnemyActions actionsScript = newEnemy.GetComponent <EnemyActions>(); actionsScript.player = player; actionsScript.projectile = projectile; actionsScript.projectile_speed = projectile_speed; actionsScript.reload_speed = reload_speed; actionsScript.decomposeTime = decomposeTime; } }
private void Start() { enemyActions = new EnemyActions(LoadEnemyActions()); // SaveGameData(); UpdateNextAction(); currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth); currentHealth = maxHealth; armor = 0; healthText.text = currentHealth.ToString(); armorText.text = armor.ToString(); GetComponent <CharacterStats>().OnHealthChanged += OnHealthTextChanged; GetComponent <CharacterStats>().OnArmorChanged += OnArmorTextChanged; }
public Enemy getThirdEnemy() { EnemyTurnData enemyTurnData = new EnemyTurnData(); enemyTurnData.randomAttackOrder = true; enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(3, 6), new CardActions())); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(6, 3), new CardActions())); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(8, 0), new CardActions())); EnemyData data = new EnemyData(new HealthBarData(18), enemyTurnData); EnemyActions enemyActions = new EnemyActions(); enemyActions.onDeathAction = () => { //TODO: add vulnerable on death }; Enemy enemy = new Enemy(data, enemyActions); return(enemy); }
public Enemy getFirstEnemy() { EnemyTurnData enemyTurnData = new EnemyTurnData(); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(12, 0), new CardActions())); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(0, 11), new CardActions())); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(6, 8), new CardActions())); enemyTurnData.baseEnemyTurns.Add(new Card(new CardData(8, 6), new CardActions())); EnemyActions enemyActions = new EnemyActions(); enemyActions.onShuffleAction = () => { //TODO: add vulnerable card on shuffle }; //basicEnemy.animatorController = Resources.Load<RuntimeAnimatorController>(spritePath + "MaskManController"); EnemyData data = new EnemyData(new HealthBarData(40), enemyTurnData); Enemy enemy = new Enemy(data, enemyActions); return(enemy); }
public Enemy getSecondEnemy() { EnemyTurnData enemyTurnData = new EnemyTurnData(); CardData attackCardData = new CardData(); CardActions attackCardActions = new CardActions(); attackCardData.attack = 3; attackCardData.isEnemycard = true; attackCardData.description = "Add " + attackCardData.attack + " to enemies attack"; CardData multiplierCardData = new CardData(); CardActions multiplierCardActions = new CardActions(); multiplierCardData.attackMultiplier = 2; multiplierCardData.isEnemycard = true; multiplierCardData.description = "Repeat enemy attack " + (multiplierCardData.attackMultiplier - 1) + " times"; Card attackTurn1 = addCardToDeckTurn(new Card(attackCardData, attackCardActions)); attackTurn1.data.attack = 3; Card attackTurn2 = addCardToDeckTurn(new Card(attackCardData, attackCardActions)); attackTurn2.data.attack = 3; Card multiplierTurn = addCardToDeckTurn(new Card(multiplierCardData, multiplierCardActions)); multiplierTurn.data.attack = 3; enemyTurnData.baseEnemyTurns.Add(attackTurn1); enemyTurnData.baseEnemyTurns.Add(attackTurn2); enemyTurnData.baseEnemyTurns.Add(multiplierTurn); EnemyActions enemyActions = new EnemyActions(); //basicEnemy.animatorController = Resources.Load<RuntimeAnimatorController>(spritePath + "MaskManController"); EnemyData data = new EnemyData(new HealthBarData(55), enemyTurnData); Enemy enemy = new Enemy(data, enemyActions); return(enemy); }
public virtual IEnumerator Attack(float waitTimeBeforeAttack = 0) { if (Attacking) { yield break; } else { CharAnimator.SetFloat("speed", 0); if (waitTimeBeforeAttack > 0) { yield return(new WaitForSeconds(waitTimeBeforeAttack)); } CurrentAction = EnemyActions.Attack; Attacking = true; } if (CloseCombat) { //if (MyCharacterController.Instance.Grounded && MyCharacterController.Instance.KoManager.Ko) //{ // ActivateEndOfAnimationTrigger = true; // var kickAttack = (Random.value < 0.5f); // if (kickAttack) // { // CharAnimator.SetTrigger("bottom_weak_attack_punch"); // MyCharacterController.Instance.TakeDamage("bottom_weak_attack2", 50f, transform); // } // else // { // CharAnimator.SetTrigger("bottom_weak_attack_kick"); // MyCharacterController.Instance.TakeDamage("bottom_weak_attack1", 50f, transform); // } // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/meleeJab2")); //} //if (Random.value < 0.5f) //{ ActivateEndOfAnimationTrigger = true; var kickAttack = (Random.value < 0.5f); if (kickAttack) { CharAnimator.SetTrigger("weak_attack_punch"); var weakAttackName = RightAttack ? "right_weak_attack1" : "left_weak_attack1"; MyCharacterController.Instance.TakeDamage(weakAttackName, 50f, transform); } else { CharAnimator.SetTrigger("weak_attack_kick"); var weakAttackName = RightAttack ? "right_weak_attack2" : "left_weak_attack2"; MyCharacterController.Instance.TakeDamage(weakAttackName, 50f, transform); } //audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/meleeJab2")); RightAttack = !RightAttack; //} //else //{ // var rand = Random.value; // if (rand <= 0.33f) // { // ActivateEndOfAnimationTrigger = true; // CharAnimator.Play("Combo1"); // MyCharacterController.Instance.TakeDamage("combo1", 150f, transform); // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/pain2")); // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/mediumkick")); // yield return new WaitForSeconds(0.34f); // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/mediumpunch")); // yield return new WaitForSeconds(0.4f); // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/powerHit6")); // yield return new WaitForSeconds(0.3f); // audio.PlayOneShot(Resources.Load<AudioClip>("Sounds/mediumkick")); // } // else if (rand <= 0.66f) // { // yield return StartCoroutine(Combo2()); // } //} } //else //{ // if (Random.value < 0.33 && SpecialDistanceAttackEnabled) // { // yield return StartCoroutine(CastSpecialDistanceAttack()); // } // else // { // var nbBlast = Random.Range(4, 6) + 1; // yield return StartCoroutine(AttackWithBlast(nbBlast)); // } //} }
//crucial to returning action so a dead guy doesn't hold on to it forever, may want a check in the director public void ChangeAction(EnemyActions act) { myAction = act; }
// @TODO: maybe consider using the automatic constructor? how would that work? public EnemyActions(EnemyActions enemyActions) { actions = enemyActions.actions; random = new System.Random(); nextAction = GetAction(); }
public Enemy(EnemyData data, EnemyActions enemyActions) { this.data = data; this.enemyActions = enemyActions; }
// Start is called before the first frame update void Start() { enemyActions = gameObject.GetComponentInParent <EnemyActions>(); }
// Run the actions associated with that ship private void RunAction() { EnemyActions.runAction(this.gameObject); }
private void SwitchAction(EnemyActions action) { // print (enemy.Action + "/" + action); if (enemy.Action != action) { switch (enemy.Action) { case EnemyActions.Idle: { enemy.NavAgent.Resume(); break; } case EnemyActions.GoToRandomPoint: { StopCoroutine("WaitSeconds"); isWaiting = false; enemy.ResetNavAgent(transform); break; } case EnemyActions.GoToPathPoint: { StopCoroutine("WaitSeconds"); isWaiting = false; enemy.ResetNavAgent(transform); break; } case EnemyActions.WatchPlayer: { StopCoroutine("WatchPlayer"); isWatchingPlayer = false; enemy.Fov.isCentered = true; break; } case EnemyActions.FollowPlayerPoint: { StopCoroutine("FollowPlayerPoint"); isFollowingPlayerPoint = false; enemy.enableProjector(false); break; } case EnemyActions.SearchL: { StopCoroutine("SearchL"); isSearching = false; break; } case EnemyActions.SearchM: { StopCoroutine("SearchM"); isSearching = false; enemy.Fov.rotateSpeed = 1.0f; break; } case EnemyActions.ReturnToInitialPosition: { StopCoroutine("ReturntoInit"); isReturningToInit = false; break; } case EnemyActions.runTowardPlayer: { enemy.enableProjector(false); break; } case EnemyActions.Wait: { StopCoroutine("WaitSeconds"); isWaiting = false; isWaitDone = false; break; } case EnemyActions.Distracted: { StopCoroutine("Distracted"); isDistracted = false; if (!enemy.DistractionObject) { IsDistractionDetected = false; } // isSearchDone = true; break; } } enemy.Action = action; publicAction = action; } }
private void Awake() { animator = GetComponentInChildren <Animator>(); enemyActions = GetComponentInChildren <EnemyActions>(); enemyActions.OnTakenDamage += OnTakenDamage; }
private void SwitchAction(EnemyActions action) { // print (enemy.Action + "/" + action); if(enemy.Action != action) { switch(enemy.Action) { case EnemyActions.Idle: { enemy.NavAgent.Resume(); break; } case EnemyActions.GoToRandomPoint: { StopCoroutine("WaitSeconds"); isWaiting = false; enemy.ResetNavAgent(transform); break; } case EnemyActions.GoToPathPoint: { StopCoroutine("WaitSeconds"); isWaiting = false; enemy.ResetNavAgent(transform); break; } case EnemyActions.WatchPlayer: { StopCoroutine("WatchPlayer"); isWatchingPlayer = false; enemy.Fov.isCentered = true; break; } case EnemyActions.FollowPlayerPoint: { StopCoroutine("FollowPlayerPoint"); isFollowingPlayerPoint = false; enemy.enableProjector(false); break; } case EnemyActions.SearchL: { StopCoroutine("SearchL"); isSearching = false; break; } case EnemyActions.SearchM: { StopCoroutine("SearchM"); isSearching = false; enemy.Fov.rotateSpeed = 1.0f; break; } case EnemyActions.ReturnToInitialPosition: { StopCoroutine("ReturntoInit"); isReturningToInit = false; break; } case EnemyActions.runTowardPlayer: { enemy.enableProjector(false); break; } case EnemyActions.Wait: { StopCoroutine("WaitSeconds"); isWaiting = false; isWaitDone = false; break; } case EnemyActions.Distracted: { StopCoroutine("Distracted"); isDistracted = false; if(!enemy.DistractionObject) IsDistractionDetected = false; // isSearchDone = true; break; } } enemy.Action = action; publicAction = action; } }
// Start is called before the first frame update void Start() { animator = this.GetComponent <Animator>(); ea = GetComponentInParent <EnemyActions>(); }