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);
    }
예제 #2
0
    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);
                }
            }
        }
    }
예제 #3
0
    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;
    }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     GetEnemyMovementCtrl = GetComponent <EnemyMovementController>();
     SetDirector(GetComponentInParent <GroupDirector>());
     playerT  = GameObject.FindGameObjectWithTag("Player").transform;
     myAction = EnemyActions.None;
 }
예제 #5
0
 private void Awake()
 {
     enemyStatistics = GetComponent <EnemyStatistics>();
     enemyMovement   = GetComponent <EnemyMovement>();
     enemyActions    = GetComponent <EnemyActions>();
     brain           = GameObject.FindGameObjectWithTag(Tags.Brain);
 }
예제 #6
0
    public virtual IEnumerator Idle(float time)
    {
        CharAnimator.SetFloat("speed", 0);
        CurrentAction = EnemyActions.Idle;
        yield return(new WaitForSeconds(time));

        RandomAction();
    }
예제 #7
0
    void DefMagicButtonAction()
    {
        Debug.Log("Def magic release!");
        PlayerActions action;

        action = GameObject.FindWithTag("Player").GetComponent <PlayerActions>();

        action.defMagMethod();
    }
예제 #8
0
    void GiveUpButtonAction()
    {
        PlayerActions action;

        // attackFlag = true;//animator
        action = GameObject.FindWithTag("Player").GetComponent <PlayerActions>();

        action.giveUpMethod();
    }
예제 #9
0
    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;
    }
예제 #11
0
    protected override void Awake()
    {
        base.Awake();

        model = transform.GetChild(0);
        //color = AssignColor();
        enemyActions = GetComponent<EnemyActions>();
        enemyMovement = GetComponent<EnemyMovement>();
        levelManager = FindObjectOfType<LevelManager>();
    }
예제 #12
0
        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();
            }
        }
예제 #14
0
 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);
 }
예제 #15
0
파일: Turn.cs 프로젝트: jluedtke/The-Seven
 private void Start()
 {
     if (transform.gameObject.name == "Player")
     {
         pActions  = GetComponent <PlayerActions>();
         pMovement = GetComponent <PlayerMovement>();
         return;
     }
     else
     {
         eActions  = GetComponent <EnemyActions>();
         eMovement = GetComponent <EnemyMovement>();
     }
 }
예제 #16
0
    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);
    }
예제 #17
0
    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>();
    }
예제 #18
0
    // 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;
        }
    }
예제 #19
0
    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);
    }
예제 #23
0
    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));
        //    }
        //}
    }
예제 #24
0
 //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;
 }
예제 #25
0
 // @TODO: maybe consider using the automatic constructor? how would that work?
 public EnemyActions(EnemyActions enemyActions)
 {
     actions    = enemyActions.actions;
     random     = new System.Random();
     nextAction = GetAction();
 }
예제 #26
0
 public Enemy(EnemyData data, EnemyActions enemyActions)
 {
     this.data         = data;
     this.enemyActions = enemyActions;
 }
예제 #27
0
 // Start is called before the first frame update
 void Start()
 {
     enemyActions = gameObject.GetComponentInParent <EnemyActions>();
 }
예제 #28
0
 // Run the actions associated with that ship
 private void RunAction()
 {
     EnemyActions.runAction(this.gameObject);
 }
예제 #29
0
        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;
            }
        }
예제 #30
0
 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;
            }
        }
예제 #32
0
 // Start is called before the first frame update
 void Start()
 {
     animator = this.GetComponent <Animator>();
     ea       = GetComponentInParent <EnemyActions>();
 }