Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        LilypadController lily = collision.GetComponent <LilypadController>();

        if (lily != null)
        {
            lily.Kill();
        }
    }
Пример #2
0
 private void Outside()
 {
     pad = null;
     GetComponent <Collider2D>().isTrigger = false;
     GetComponent <Rigidbody2D>().useFullKinematicContacts = true;
     StopAllCoroutines();
     transform.SetParent(null);
     SetSpeed(velocity);
 }
Пример #3
0
    private void Inside(LilypadController ctrl)
    {
        pad = ctrl;
        GetComponent <Collider2D>().isTrigger    = true;
        GetComponent <Rigidbody2D>().velocity    = Vector2.zero;
        GetComponent <Rigidbody2D>().isKinematic = true;
        Vector2 direction = (transform.position - pad.transform.position).normalized;

        StartCoroutine(StartBiting(direction));
        transform.SetParent(ctrl.transform);
    }
Пример #4
0
    private void OnTriggerStay2D(Collider2D other)
    {
        if (position_reached)
        {
            return;
        }

        LilypadController lily = other.GetComponent <LilypadController>();

        if (lily != null)
        {
            parentLily = lily;
        }
    }
Пример #5
0
    public void StartGame()
    {
        if (LilySpawner == null)
        {
            LilySpawner = FindObjectOfType <LilypadSpawner>();
        }
        LilySpawner.gameObject.SetActive(true);
        if (originalLilyDelay == -1)
        {
            originalLilyDelay = LilySpawner.SpawnInfo.DelayBetweenSpawns;
        }
        LilySpawner.SpawnInfo.DelayBetweenSpawns /= PointsMultiplier;

        if (BugsSpawner == null)
        {
            BugsSpawner = FindObjectOfType <BugsSpawner>();
        }
        BugsSpawner.gameObject.SetActive(true);
        if (originalBugsDelay == -1)
        {
            originalBugsDelay = BugsSpawner.SpawnInfo.DelayBetweenSpawns;
        }
        BugsSpawner.SpawnInfo.DelayBetweenSpawns /= PointsMultiplier;

        LilySpawner.SpawnLilypad();

        if (Frog == null)
        {
            Frog = FindObjectOfType <FrogController>();
        }
        Frog.gameObject.SetActive(true);

        LilypadController spawnedLily = GetCloseLilyPad(Frog.transform.position, 100);

        Frog.transform.position = spawnedLily.transform.position;
        Frog.SetParentLily(spawnedLily);

        if (UICtrl == null)
        {
            UICtrl = FindObjectOfType <UIController>();
        }
        UICtrl.ToggleMainMenu(false);

        if (inputCtrl == null)
        {
            inputCtrl = GetComponent <InputController>();
        }
        inputCtrl.enabled = true;
    }
Пример #6
0
 private void Update()
 {
     if (!pad && bugRenderer.isVisible)
     {
         LilypadController _pad = GameManager.I.GetCloseLilyPad(transform.position, EatingRadius);
         if (_pad)
         {
             Inside(_pad);
         }
     }
     else if (pad && Vector2.Distance(transform.position, pad.transform.position) > EatingRadius + 0.2f)
     {
         Outside();
     }
 }
Пример #7
0
 public void ReturnLilyToPull(LilypadController _lily)
 {
     lilypadsPull.Add(_lily);
     lilypadsActive.Remove(_lily);
     _lily.gameObject.SetActive(false);
 }
Пример #8
0
 public void SetParentLily(LilypadController _parentLily)
 {
     parentLily       = _parentLily;
     transform.parent = parentLily.transform;
 }