// Use this for initialization void Start() { _elapsed = 0; gameBounds = GameObject.FindObjectOfType <GameBounds>(); prefab.CreatePool(); }
private void SetPosition() { _currentPos += _dir * _deltaPos; _deltaPos.Set(0f, 0f, 0f); if (_config != null && _config.BlockedOnScreen) { GameBounds.ClampsThisPosition(ref _currentPos); _trans.position = _currentPos; } else { if (GameBounds.IsOnDeathArea(_currentPos)) { if (OnOutOfBounds != null) { OnOutOfBounds(); } } else { _trans.position = _currentPos; } } }
void Update() { _rb.MovePosition(_rb.position + transform.forward * Time.deltaTime * Speed); if (!GameBounds.IsWithinBounds(transform.position)) { GameObject.Destroy(gameObject); } }
private void Awake() { GameBounds gb = FindObjectOfType <GameBounds>(); if (gb) { bounds = gb.bounds; } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
void Update() { var speed = Mathf.Lerp(Speed.x, Speed.y, _difficulty); _rb.MovePosition(_rb.position + Vector3.back * Time.deltaTime * speed); if (!GameBounds.IsWithinBounds(transform.position)) { GameObject.Destroy(gameObject); } //_hull.Fire(true); // TODO: FIRE }
void FixedUpdate() { //Movement och sånt var horizontal = Input.GetAxis("Horizontal"); var vertical = Input.GetAxis("Vertical"); _movementVector = Vector3.Lerp(_movementVector, new Vector3(horizontal, 0, vertical).normalized, Time.deltaTime * SpeedEase); var moveVec = new Vector3(_movementVector.x * Speed.x, 0f, _movementVector.z * Speed.y); var wantedPosition = GameBounds.ClampToBounds(_rb.position + (moveVec * Time.deltaTime)); _rb.MovePosition(Vector3.Lerp(_rb.position, wantedPosition, Time.deltaTime * SpeedEase)); }
protected override void Awake() { base.Awake(); GameBounds gb = FindObjectOfType <GameBounds>(); if (gb) { movementBounds = gb.bounds; } rigidbody = GetComponent <Rigidbody>(); }
void Update() { _difficultyTimer += Time.deltaTime / DifficultyTime; _timer -= Time.deltaTime; if (_timer < 0) { var curveValue = DifficultyCurve.Evaluate(_difficultyTimer); var randomIndex = GetRandomEnemyToSpawn(); var enemySettings = Enemies[randomIndex]; var enemy = GameObject.Instantiate(enemySettings.Prefab, GameBounds.GetRandomSpawnPosition(), Quaternion.identity, transform).GetComponent <Enemy>(); enemy.SetDifficulty(curveValue); var spawnTimer = Mathf.Lerp(SpawnTimer.x, SpawnTimer.y, curveValue); _timer = 1f / spawnTimer; } }
// Use this for initialization void Start () { sBounds = this; }
// Use this for initialization void Start() { sBounds = this; }