Пример #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        AudioManager.instance.PlaySound(AudioStorage.SoundList["HittingAsteroid"]);
        docks = GetComponentsInChildren <Dock>();
        int numOfDestroyedModules = Random.Range(1, maxNumber);

        for (int i = 0; i < maxNumber; i++)
        {
            int rand = Random.Range(0, docks.Length - 1);
            if (docks[rand].item != null)
            {
                DockHandler buff = docks[rand].item;
                docks[rand].Dettach();
                buff.GetComponent <DockHandler>().StartCoroutine("BlinkEnable");
                buff.GetComponent <Rigidbody2D>().velocity = buff.transform.localPosition * (new Vector2(1, 1) * speed * 0.01f);
            }
        }
    }
Пример #2
0
 public void Attach(DockHandler item)
 {
     wire.enabled = true;
     if (Docked() == false)
     {
         StartCoroutine(CamShake.instance.Shake(.01f, .05f));
         AudioManager.instance.PlaySound(AudioStorage.SoundList["AttachingModule"], transform.position);
     }
     this.item = item;
     item.GetComponent <IAttachable>().OnAttach();
 }