Exemple #1
0
    void Topple(bool isForward)
    {
        int sign = isForward ? 1 : -1;

        rb.AddForceAtPosition(sign * transform.forward * 150f * rb.mass, transform.position + Vector3.up);
        dominoState = DominoState.Toppling;
    }
Exemple #2
0
    void CheckTopped()
    {
        float xAngle = Vector3.Angle(Vector3.up, transform.up);

        if (xAngle < 45)
        {
            return;
        }
        if (90 < xAngle)
        {
            return;
        }
        dominoState          = DominoState.Toppled;
        addGravity.downForce = 0;
    }
Exemple #3
0
 void Start()
 {
     forwardDomino  = GetForwardDomino(isForward: true);
     backwardDomino = GetForwardDomino(isForward: false);
     dominoState    = DominoState.Standing;
 }