public void InitGenericWalker(int _maxHealth, int _startingDamage, float _startingSpeed, float _startingAttackSpeed, WalkerType _type, EnemyWalkingTrack _myTrack, LayerMask _attackMask) { AttackLayerMask = _attackMask; myTrack = _myTrack; maxHealth = _maxHealth; startingDamage = _startingDamage; startingSpeed = _startingSpeed; startingAttackSpeed = _startingAttackSpeed; myType = _type; currentHealth = maxHealth; nextTrackIndex = _type == WalkerType.Enemy ? 0 : _myTrack.Points - 1; alive = true; if (myType == WalkerType.Enemy) { indexDiff = 1; if (myTrack.side == EnemyWalkingTrackSide.Left) { walkingDirection = WalkingDirection.Right; } else { walkingDirection = WalkingDirection.Left; } } else { indexDiff = -1; if (myTrack.side == EnemyWalkingTrackSide.Left) { walkingDirection = WalkingDirection.Left; } else { walkingDirection = WalkingDirection.Right; } } }
// Use this for initialization void Start() { Debug.Log("sprite renderer position: " + sr.transform.position); trackLeft = new EnemyWalkingTrack(sr.sprite, EnemyWalkingTrackSide.Left, sr.transform); }