Beispiel #1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (isAlly)
     {
         Mouse hittedMouse = collision.collider.gameObject.GetComponent <Mouse>();
         if (hittedMouse)
         {
             if (hittedMouse.isEnemy)
             {
                 if (mouseColorId == hittedMouse.mouseColorId)
                 {
                     GrowInNumbers kingGrow = hittedMouse.growInNumbers;
                     if (kingGrow)
                     {
                         kingGrow.RemoveMouse(hittedMouse.transform);
                         if (kingGrow.activeMouses.Count == 0)
                         {
                             FindObjectOfType <Run>().FinishGame();
                         }
                     }
                 }
                 else
                 {
                     growInNumbers.RemoveMouse(transform);
                 }
             }
         }
     }
 }
Beispiel #2
0
    void Update()
    {
        rb.velocity = new Vector2(0f, 0f);
        transform.Rotate(0, 0, 0);
        if (growInNumbers.activeMouses.Count == 1)
        {
            if (direction != Vector3.zero)
            {
                transform.up = Vector3.Lerp(transform.up, direction + littleOffset, Time.deltaTime * 10f);
            }
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            hypnosis.Hypnotize();
            //Transform randMouse = growInNumbers.RandomFreeMouse();
            //if (randMouse)
            //{
            //    growInNumbers.AddNewMouse(randMouse);
            //}
        }
#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (growInNumbers.activeMouses.Count > 1)
            {
                growInNumbers.RemoveMouse(growInNumbers.activeMouses[Random.Range(1, growInNumbers.activeMouses.Count)]);
            }
        }
        if (Input.GetKeyDown(KeyCode.O))
        {
            FinishGame();
        }
        if (Input.GetKeyDown(KeyCode.P))
        {
            Debug.Log("Cheats editor-only");
            Transform randMouse = growInNumbers.RandomFreeMouse();
            if (randMouse)
            {
                growInNumbers.AddNewMouse(randMouse);
            }
            King king = FindObjectOfType <King>();
            if (king)
            {
                king.enabled = false;
            }
        }
#endif
        if (gameIsFinished)
        {
            CutSceneFinal();
        }
    }