Exemple #1
0
 // Start is called before the first frame update
 void Start()
 {
     enemy             = GameObject.FindGameObjectWithTag("Enemy").GetComponent <EnemyMover>();
     enemy.WalkForward = true;
     Health            = 100;
     knack             = GameObject.FindGameObjectsWithTag("Knack");
 }
 protected override void Awake()
 {
     base.Awake();
     enemyMover  = GetComponent <EnemyMover>();
     enemySensor = GetComponent <EnemySensor>();
     enemyAttack = GetComponent <EnemyAttack>();
 }
    public virtual EnemyMover SwitchMover(System.Type switchTo)
    {
        if (switchTo == null)
        {
            Debug.LogError("Switching to empty mover is nono");
            return(null);
        }

        EnemyMover[] currentMovers = GetComponents <EnemyMover>();
        if (currentMovers == null)
        {
            Debug.LogError("Something went wrong while switching movers");
        }
        else
        {
            foreach (EnemyMover mover in currentMovers)
            {
                Destroy(mover);
            }
        }

        EnemyMover newMover = CreateMover(switchTo);

        this._myMover = newMover;

        return(newMover);
    }
    void Start()
    {
        //Debug.Log (transform.localScale);
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameController>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script\n");

            scaleUp = 1;
        }
        else
        {
            scaleUp = CalScaleUp(gameController.GetLevel());
        }

        transform.localScale *= scaleUp;

        enemyMover = gameObject.GetComponentInParent <EnemyMover>();
        if (enemyMover == null)
        {
            Debug.Log("Cannot find 'EnemyMover' Script");
        }
        //else Debug.Log ("Found 'EnemyMover' Script");

        player = GameObject.FindWithTag("Player");

        StartCoroutine(Detect());
    }
 protected override void Awake()
 {
     base.Awake();
     m_board      = Object.FindObjectOfType <Board>().GetComponent <Board>();
     m_enemyMover = GetComponent <EnemyMover>();
     m_enemySenor = GetComponent <EnemySensor>();
 }
 public EnemyAnimator(Animator animator, EnemyMover enemyMover, EnemyRotator enemyRotator, EffectGenerator[] effectGenerators, PhysicsAttackable[] attackables)
 {
     this.animator         = animator;
     this.enemyMover       = enemyMover;
     this.enemyRotator     = enemyRotator;
     this.effectGenerators = effectGenerators;
     this.attackables      = attackables;
 }
Exemple #7
0
 private void Awake()
 {
     mover            = GetComponent <EnemyMover>();
     fighter          = GetComponent <EnemyFighter>();
     health           = GetComponent <Health>();
     player           = GameObject.FindWithTag("Player").transform;
     playerController = player.gameObject.GetComponent <PlayerController>();
 }
    protected override void Awake()
    {
        base.Awake();

        _board       = FindObjectOfType <Board>().GetComponent <Board>();
        _enemyMover  = GetComponent <EnemyMover>();
        _enemySensor = GetComponent <EnemySensor>();
        _enemyAttack = GetComponent <EnemyAttack>();
    }
Exemple #9
0
 public void Construct(EnemyBehavior behevior, EnemyHealth health, EnemyAnimatorController animatorController, EnemyMover enemyMover, EnemyDistanceSkills distanceSkills, Shooter shooter)
 {
     _behevior           = behevior;
     _health             = health;
     _animatorController = animatorController;
     _enemyMover         = enemyMover;
     _distanceSkills     = distanceSkills;
     _shooter            = shooter;
 }
Exemple #10
0
 void Start()
 {
     enemyShips   = new List <List <GameObject> >();
     retryHandler = GetComponent <RetryHandler>();
     mover        = GetComponent <EnemyMover>();
     CreatePlayer();
     InitiateStageOne();
     SuspendShips();
 }
Exemple #11
0
    private void SpawnEnemy()
    {
        score++;
        spawnedEnemies.text = score.ToString();
        GetComponent <AudioSource>().PlayOneShot(enemySpawnedSFX);
        EnemyMover newEnemy = Instantiate(enemyList[0], transform.position, transform.rotation) as EnemyMover;

        newEnemy.transform.parent = transform;
    }
Exemple #12
0
    protected override void Awake()
    {
        base.Awake();

        m_board       = Object.FindObjectOfType <Board>().GetComponent <Board>();
        m_enemyMover  = GetComponent <EnemyMover>();
        m_enemySensor = GetComponent <EnemySensor>();
        m_enemyDeath  = GetComponent <EnemyDeath>();
        m_player      = Object.FindObjectOfType <PlayerManager>().GetComponent <PlayerManager>();
    }
Exemple #13
0
    public override void Initialize()
    {
        base.Initialize();
        board        = FindObjectOfType <Board>();
        enemyMover   = GetComponent <EnemyMover>();
        enemieSensor = GetComponent <EnemySensor>();
        enemyAttack  = GetComponent <EnemyAttack>();

        enemyMover.FinishMovementEvent.AddListener(() => FinishTurn());
    }
 private void Awake()
 {
     animator      = GetComponent <Animator>();
     player        = GameObject.FindGameObjectWithTag("Player").transform;
     guardPosition = transform.position;
     mover         = GetComponent <EnemyMover>();
     playerFighter = player.GetComponent <PlayerFighter>();
     myCollider    = GetComponent <Collider2D>();
     stashSystem   = FindObjectOfType <WeaponStashSystem>();
 }
Exemple #15
0
    private void Awake()
    {
        _enemyMover = new EnemyMover(GetComponent <Rigidbody>(), transform);

        if (isShotable == false)
        {
            return;
        }
        _enemyShooter = GetComponent <EnemyShooter>();
    }
Exemple #16
0
 private void Awake()
 {
     _mover    = GetComponent <EnemyMover>();
     _state    = GetComponent <EnemyState>();
     _animator = GetComponent <FSM>();
     _input    = GetComponent <ICharacterInput <EnemyInput> >();
     _input.OnReceivedInput += HandleReceivedInput;
     _hitBox.OnHit          += HandleOnHit;
     _launcher.Target        = FindObjectOfType <PlayerCharacter>().HittingPoint;
     _animator.Subscribe(Animation.AnimationState.Completed, HandleAnimationEvent);
 }
Exemple #17
0
 public void TakeDamage(EnemyMover enemy)
 {
     GetComponent <AudioSource>().PlayOneShot(damageSFX);
     health         -= enemy.attackPower;
     healthText.text = health.ToString();
     StartCoroutine(FlashHit());
     if (health <= 0)
     {
         DestroyBase();
     }
 }
Exemple #18
0
 private void Awake()
 {
     _shooter        = GetComponent <EnemyShooter>();
     _mover          = GetComponent <EnemyMover>();
     _jumper         = GetComponent <EnemyJumper>();
     _enemyAnimator  = GetComponent <EnemyAnimator>();
     _health         = GetComponent <Health>();
     _collider       = GetComponent <BoxCollider>();
     _enemyHolder    = FindObjectOfType <EnemyHolder>();
     _characterAudio = GetComponent <CharacterAudio>();
 }
Exemple #19
0
 private void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Enemy")
     {
         EnemyMover monster = collider.gameObject.GetComponent <EnemyMover>();
         if (!monster.IsDying())
         {
             gameController.GameOver(false);
         }
     }
 }
Exemple #20
0
 IEnumerator <WaitForSeconds> SpawnEnemies( )
 {
     for (int i = 0; i < numberOfEnemies; i++)
     {
         EnemyMover enemy = Instantiate(enemyPrefab, transform.position, Quaternion.identity);
         enemy.transform.parent = parent;
         scoreText.text         = (scoreMultiplier * (i + 1)).ToString( );
         FindObjectOfType <AudioSource>( ).PlayOneShot(spawnSFX);
         yield return(new WaitForSeconds(secondsBetweenSpawns));
     }
 }
Exemple #21
0
 void OnTriggerEnter(Collider other)
 {
     // End the game if an enemy not in the dying state hits us.
     if (other.tag == "Enemy")
     {
         EnemyMover badGuy = other.gameObject.GetComponent <EnemyMover>();
         if (!badGuy.IsDying())
         {
             gameController.GameOver(false);
         }
     }
 }
    void FixedUpdate()
    {
        if (!isSceneLoaded)
        {
            return;
        }

        if (UIObject.GetComponent <UIInfo>().enemyStatusUIGroup.activeInHierarchy&& selectedCharacter == null)
        {
            UIObject.GetComponent <UIInfo>().enemyStatusUIGroup.SetActive(false);
        }
        else if (!UIObject.GetComponent <UIInfo>().enemyStatusUIGroup.activeInHierarchy&& selectedCharacter != null)
        {
            UIObject.GetComponent <UIInfo>().enemyStatusUIGroup.SetActive(true);
        }

        if (turn == 1)
        {
            bool b = true;
            foreach (Character e in enemies)
            {
                if (e.type != Character.Type.Enemy || !e.Alive)
                {
                    continue;
                }
                EnemyMover em = (EnemyMover)e.Mover;
                if (!em.Moved)
                {
                    b = false;
                    break;
                }
            }
            if (b)
            {
                NextTurn();
            }
        }

        // 재시작 기능

        /*
         * if (!player.Alive && Input.GetKeyDown(KeyCode.R))
         * {
         *  restartText.SetActive(false);
         *  player.GetComponent<Inventory>().RemoveAllItems();   // 가지고 있던 모든 아이템을 잃음
         *  player.GetComponent<Inventory>().Gold /= 2;
         *  player.Revive();
         *  //mapLevel[map.mapName]--;
         *  mapLevel--;
         *  ChangeScene("Town");
         * }
         */
    }
Exemple #23
0
    public static int totalEnemies; //reset during game over

    // Use this for initialization
    void Start()
    {
        Mover       = GetComponentInParent <EnemyMover>();
        AI          = GetComponentInParent <FSM>();
        Shooter     = GetComponentInParent <EnemyShooter>();
        CurrentTurn = FindObjectOfType <Turn>();

        //meshes
        firingMesh.SetActive(false);
        meleeMesh.SetActive(false);
        acting = false;
    }
Exemple #24
0
    protected override void Awake()
    {
        base.Awake();

        m_board         = Object.FindObjectOfType <Board>().GetComponent <Board>();
        m_enemyMover    = GetComponent <EnemyMover>();
        m_enemySensor   = GetComponent <EnemySensor>();
        m_enemyAttack   = GetComponent <EnemyAttack>();
        m_skeletonArrow = GetComponent <ShootArrow>();

        godMode = Object.FindObjectOfType <GodModeManager>();
    }
    public List <EnemyManager> FindEnemiesAt(Node node)
    {
        List <EnemyManager> foundEnemies = new List <EnemyManager>();

        EnemyManager[] enemies = Object.FindObjectsOfType <EnemyManager>() as EnemyManager[];
        foreach (EnemyManager enemy in enemies)
        {
            EnemyMover mover = enemy.GetComponent <EnemyMover>();
            if (mover.CurrentNode == node)
            {
                foundEnemies.Add(enemy);
            }
        }
        return(foundEnemies);
    }
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameController>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }

        blockSpeed = GetComponentInParent <EnemyMover>();
    }
Exemple #27
0
        // This moves the enemy in the game running environment
        void Update()
        {
            Vector3    outPos;
            Quaternion outRot;
            Waypoint   outWay;

            EnemyMover.Solve(gameObject.GetHashCode(), transform.position, transform.rotation, moveSpeed, rotationSpeed, Time.deltaTime, target, 0.25f, out outPos, out outRot, out outWay);

            transform.position = outPos;
            transform.rotation = outRot;
            target             = outWay;

            currentPosition = transform.position;
            currentRotation = transform.rotation;
        }
Exemple #28
0
        // This siumulates the enemy's movement based on the actual enemy movement
        public void Simulate(float time)
        {
            Vector3    outPos;
            Quaternion outRot;
            Waypoint   outWay;

            EnemyMover.Solve(gameObject.GetHashCode(), dummyPosition, dummyRotation, moveSpeed, rotationSpeed, time, dummyTarget, 0.25f, out outPos, out outRot, out outWay);

            dummyPosition = outPos;
            dummyRotation = outRot;
            dummyTarget   = outWay;

            currentPosition = dummyPosition;
            currentRotation = dummyRotation;
        }
Exemple #29
0
 void Start()
 {
     this.cc         = this.GetComponent <CircleCollider2D>();
     this.cc.enabled = true;
     if (this.movement == null)
     {
         this.movement = this.GetComponent <EnemyMover>();
     }
     this.enemyField      = GameObject.FindWithTag("Enemies").GetComponent <Transform>();
     this.gameController  = GameObject.FindWithTag("GameController").GetComponent <GameController>();
     this.fighterRespawn  = GameObject.FindWithTag("Respawn").transform;
     this.fighter         = this.fighterRespawn.GetComponentInChildren <FighterController>();
     this.sfx             = GameObject.FindWithTag("Audio_SFX").GetComponent <AudioSource>();
     this.timeUntilAttack = this.attackCooldownMin + UnityEngine.Random.value * (this.attackCooldownMax - this.attackCooldownMin);
     this.state           = EnemyState.Idle;
 }
Exemple #30
0
    IEnumerator PickSniperRoutine()
    {
        yield return(new WaitForSeconds(delay));

        activateActivableEvent.Invoke();
        EnemyManager nearestEnemy = _board.FindNearestEnemy();

        if (nearestEnemy != null)
        {
            EnemyMover nearestMoverDest = nearestEnemy.GetComponent <EnemyMover>();
            _player_mover.destination = nearestMoverDest.CurrentNode.transform.position;
            _player_mover.FaceDestination();
            sniperAudio.Play();
            nearestEnemy.Die();
        }
    }