예제 #1
0
    public void SetState(State newState)
    {
        if (newState == currentState)
        {
            return;
        }

        switch (currentState)
        {
        case State.Walking:
            walkController.EndWalk();
            break;
        }

        currentState = newState;

        switch (currentState)
        {
        case State.Walking:
            walkController.BeginWalk();
            break;

        case State.Dead:
            SpriteRenderer renderer = GetComponent <SpriteRenderer>();
            //renderer.sortingOrder = 0;
            //renderer.sprite = deadSprite;
            animator.SetTrigger("die");
            gameLevelManager.killEnemy();
            Debug.Log("Dead");
            Destroy(gameObject, 1.5f);
            Debug.Log("Yaki kaki");
            break;
        }
    }
예제 #2
0
    private void Start()
    {
        player   = GameObject.Find("Henchman").gameObject;
        enemyRb  = GetComponent <Rigidbody2D>();
        playerRb = player.GetComponent <Rigidbody2D>();

        walkController = EnemyWalkController.Create(walkingStyle, enemyBaseSpeed, playerRb, enemyRb);
        walkController.BeginWalk();

        spriteRenderer = GetComponent <SpriteRenderer>();

        bulletController = EnemyBulletController.Create(bulletStyle, bulletSpeed, playerRb, enemyRb, bulletPrefab, minDeltaT, maxDeltaT);

        gameLevelManager = FindObjectOfType <LevelManager>();
    }