示例#1
0
    private void Start()
    {
        Componentdictionary = GetComponent <DictionaryAsteroid>();
        _valueExtremePoints = GetComponent <FindExtremePoints>();
        _checkotheasteroid  = GetComponent <CheckOnBarrier>();

        _startPosition = new Vector3(_valueExtremePoints.XRight + 10.0f, _valueExtremePoints.YTop, 1.0f);
        _startRotation = Quaternion.Euler(0, 0, 0);

        for (_counterForSpawn = 0; _counterForSpawn < CountAsteroid; _counterForSpawn++)
        {
            _startPosition.y = Random.Range(_valueExtremePoints.YBot, _valueExtremePoints.YTop);
            GameObject ObjAsteroid = Instantiate(_arrayprefubAsteroid[Random.Range(0, _arrayprefubAsteroid.Count - 1)], _startPosition, _startRotation);

            Componentdictionary._attachedScriptsToObj.Add(ObjAsteroid, ObjAsteroid.GetComponent <Asteroid>());
            Componentdictionary._attachedScriptsToObj[ObjAsteroid].GetMovementAsteroid.Speed = Random.Range(1, 7);

            _checkotheasteroid.SetSrartPositionForRayCast(Componentdictionary._attachedScriptsToObj[ObjAsteroid]);
        }
    }
示例#2
0
 void Start()
 {
     _compenentdictionary = GetComponent <DictionaryAsteroid>();
 }