コード例 #1
0
    public void RandomizeType()
    {
        enemyType = Random.Range(0, GameManager.Instance.EnemySprites.Length);
        GetComponent <SpriteRenderer>().sprite = GameManager.Instance.EnemySprites[enemyType];

        if (Balance.ENEMY_TYPES_BASE_HEALTHS[enemyType] + 4 * GameManager.Instance.Stage < Balance.ENEMY_TYPES_MAX_HEALTHS[enemyType])
        {
            health = Balance.ENEMY_TYPES_BASE_HEALTHS[enemyType] + 4 * GameManager.Instance.Stage;
        }
        else
        {
            health = Balance.ENEMY_TYPES_MAX_HEALTHS[enemyType];
        }

        switch (enemyType)
        {
        case 0:
        case 3:
            shoot = ShootPatterns.Circular;
            break;

        case 2:
            shoot = ShootPatterns.TriFanDown;
            break;

        case 5:
            shoot = ShootPatterns.DualShot;
            break;

        default:
            shoot = ShootPatterns.SingleStraightDown;
            break;
        }
    }
コード例 #2
0
    public void Init()
    {
        initialHealth = Balance.ENEMY_INITIAL_HEALTH;
        health        = initialHealth;
        originalColor = GetComponent <SpriteRenderer>().color;

        // default move delegate
        // movePattern = MovePatterns.Linear;
        if (movePattern == null)
        {
            movePattern = MovePatterns.Linear;
        }
        shoot = ShootPatterns.Circular;

        scoreValue = health;

        initialized     = true;
        enemyBulletPool = GameManager.Instance.EnemyBulletPool;
        RandomizeType();
        shootTimer           = TimerManager.Instance.CreateTimerRepeat(timeBetweenShots);
        shootTimer.onFinish += shootTimer_onFinish;
    }