コード例 #1
0
    public override void CheckCollision(ColliderCustom c)
    {
        Vector3[][] faces = this.GetFaces();

        foreach (Vector3[] face in faces)
        {
            if (c is BoxColliderCustom && ((BoxColliderCustom)c).CheckFace(face))
            {
                if (this.Stop)
                {
                    this.GetComponent <RigidbodyCustom>().StopMovement();
                }
            }
        }
    }
コード例 #2
0
    public override void CheckCollision(ColliderCustom c)
    {
        if (c is BoxColliderCustom)
        {
            List <Vector3> collisions = this.GetCollisionPoints(((BoxColliderCustom)c).GetAllPoints());

            if (collisions.Count > 0)
            {
                if (this.Bounce)
                {
                    Vector3[] face = ((BoxColliderCustom)c).GetFace(collisions);

                    Vector3 normale = ((BoxColliderCustom)c).GetNormal(face);

                    if (normale == Vector3.zero)
                    {
                        normale = new Vector3(0f, 1f, 0f);
                    }

                    this.GetComponent <RigidbodyCustom>().BounceMovement(this.BounceCoefficient, normale);
                }
            }
        }
    }
コード例 #3
0
 public abstract void CheckCollision(ColliderCustom c);