示例#1
0
    // Start is called before the first frame update
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        intialstats     = stats;
        intialPos       = transform.position * 1;
        enemyDictionary = new SortedDictionary <long, EnemyController>();
        rigidBody       = GetComponent <Rigidbody2D>();
        rangeController = GetComponentInChildren <AttackRangeController>();

        _lifeShapeController = GetComponentInChildren <LifeShapeController>();

        _lifeShapeController.Init();
        _lifeShapeController.UpdateShadow(stats.maxLifes, stats.currentLifes);

        rangeController.SetOnEnterAction(OnRangeEnter);
        rangeController.SetOnExitAction(OnRangeExit);
        _gun   = GetComponent <GunController>();
        _alive = true;
    }
示例#2
0
    public void Init(Transform _playerBase, Transform _playerPosition, int spawnOrigin, int level = 0, System.Action <EnemyController> onDieAction = null)
    {
        _onDieAction   = onDieAction;
        playerBase     = _playerBase;
        playerPosition = _playerPosition;
        _spawnOrigin   = spawnOrigin;
        SelectTarget();
        attackRange = GetComponentInChildren <AttackRangeController>();
        _lifeShape  = GetComponentInChildren <LifeShapeController>();
        _lifeShape.Init();
        _lifeShape.UpdateShadow(stats.maxLifes, stats.currentLifes);

        attackRange.SetOnEnterAction(OnRangeEnter);
        attackRange.SetOnExitAction(OnRangeExit);
        targetReached = false;
        rigidBody     = GetComponent <Rigidbody2D>();

        stats.maxLifes       += level;
        stats.speed.level    += level;
        stats.fireRate.level += level;
        stats.currentLifes    = stats.maxLifes;
    }
示例#3
0
 private void Start()
 {
     lifesCounterText = GetComponentInChildren <TextMesh>();
     _lifeShape       = GetComponentInChildren <LifeShapeController>();
     Init();
 }