Ejemplo n.º 1
0
 public void GiveParametersAsteroid(NetAsteroid obj)
 {
     asteroid    = obj;
     TextHp.text = "Прочность: " + asteroid.Health;
     CancelInvoke();
     InvokeRepeating("RefreshWindowAsteroid", 0, 0.34f);
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        asteroid = new NetAsteroid1();
        gameObject.GetComponent <SpriteRenderer>().sprite = asteroid.Sprite;
        gameObject.name = asteroid.Name;

        InitializeDrop();
    }
Ejemplo n.º 3
0
    ChooseController chooseController; //Закэшируем скрипт
    private void Start()
    {
        asteroid = gameObject.GetComponent <NetAsteroidController>().asteroid;

        capturedTarget           = Resources.Load("Prefabs/Other/CapturedTarget") as GameObject;
        obj                      = Instantiate(capturedTarget, new Vector3(transform.position.x, transform.position.y, 20), transform.rotation) as GameObject;
        obj.transform.parent     = gameObject.transform;
        obj.transform.localScale = 2.5f * gameObject.transform.localScale;

        obj.SetActive(false);

        window = GameObject.FindGameObjectWithTag("Window");                             //ищем контроллер всех объектов
        image2 = window.GetComponent <ChooseController>().image2.GetComponent <Image>(); //для быстроты

        chooseController = window.GetComponent <ChooseController>();
        textHp           = chooseController.textHp.GetComponent <TextMeshProUGUI>();     //для быстроты
        textSpeed        = chooseController.textSpeed.GetComponent <TextMeshProUGUI>();  //для быстроты
        textDamage       = chooseController.textDamage.GetComponent <TextMeshProUGUI>(); //для быстроты

        controller = chooseController.controller;                                        //для быстроты
        rb         = gameObject.GetComponent <Rigidbody2D>();                            //для доступа к скорости
    }