Exemple #1
0
    private void Awake()
    {
        // ovo ispod je zapravo transform = GetComponent<Transform>
        _transform = transform; //ovo je stvar dobre prakse, mogli smo dolje i direktno mijenjati vlasiti transform.position

        _speed          = Vector2RandomExtension.V2Random(SpeedMinAndMax);
        _distanceToKeep = Vector2RandomExtension.V2Random(DistanceToKeepMinAndMax);
    }
 private void Awake()
 {
     _damageToDeal    = Vector2RandomExtension.V2Random(DamageToDealMinAndMax);
     _knockBackForce  = Vector2RandomExtension.V2Random(KnockBackForceMinAndMax);
     _explosionForce  = Vector2RandomExtension.V2Random(ExplosionForceMinAndMax);
     _explosionRadius = Vector2RandomExtension.V2Random(ExplosionRadiusMinAndMax);
     _waitToExplode   = Vector2RandomExtension.V2Random(WaitToExplodeMinAndMax);
 }
    public IEnumerator DefineNewPosition()
    {
        while (GameManager.GM.CurrentState == GameManager.GameState.Playing)
        {
            Target = new Vector3(XRange.RandomValue(), YRange.RandomValue(), ZRange.RandomValue());
            _speed = Vector2RandomExtension.V2Random(SpeedMinAndMax);

            yield return(new WaitForSeconds(ChangeDirectionInterval.RandomValue()));
        }
    }
    private void Awake()
    {
        // ovo ispod je zapravo transform = GetComponent<Transform>
        _transform   = transform; //ovo je stvar dobre prakse, mogli smo dolje i direktno mijenjati vlasiti transform.position
        _myRigidbody = GetComponent <Rigidbody>();

        _speed = Vector2RandomExtension.V2Random(SpeedMinAndMax);

        Target = Vector3.one;

        _doesMove = true;
    }