示例#1
0
    private Vector2 GetRandomMoves()
    {
        Vector2 v2 = m_collideBox.GetColliderPosition();
        //Debug.Log("La box est en" + v2.x + "," + v2.y);
        float x = Random.Range(-m_frontiers[0], m_frontiers[0]) + v2.x;
        float y = Random.Range(-m_frontiers[1], m_frontiers[1]) + v2.y;

        //Debug.Log("On la bouge de" + -x + "," + -y);
        return(new Vector2(-x * m_collideBox.vitesse, -y * m_collideBox.vitesse));
    }
示例#2
0
文件: Moteur.cs 项目: braoutch/Trap
    void CheckForEnd()
    {
        x = player.GetPlayerPosition();
        a = collideBox.GetColliderPosition();
        r = collideBox.GetColliderScale() / 2;

        if (Mathf.Pow(x.x - a.x, 2) + Mathf.Pow(x.y - a.y, 2) > Mathf.Pow(r, 2))
        {
            life--;
            if (life < 0)
            {
                Debug.Log("Finish");
                EndGame();
                Score.EndGame();
            }
        }
        else
        {
            maxLife -= (maxLife - life) / 10f;
            life     = maxLife;
        }
    }