Ejemplo n.º 1
0
 public void Init(System.Action <BaseLogic> OnBaseDestroyAction = null)
 {
     _OnDestroyBaseAction = OnBaseDestroyAction;
     lifesCounter         = startLifes;
     _lifeShape.Init();
     _lifeShape.UpdateShadow(startLifes, _lifesCounter);
 }
Ejemplo n.º 2
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;
    }
Ejemplo n.º 3
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;
    }